package com.connfa.schedule.domain.view;

import com.google.auto.value.AutoValue;

import java.util.List;

import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

@AutoValue
public abstract class SchedulePage {

    private static final DateTimeFormatter FORMATTER = DateTimeFormat.forPattern("d-MM-yyyy");

    public static SchedulePage create(String date, List<Event> events) {
        DateTime dateTime = DateTime.parse(date, FORMATTER);
        String title = dateTime.toString("EEE d");
        return new AutoValue_SchedulePage(title, events);
    }

    public abstract String title();

    public abstract List<Event> events();
}

@@ -366,16 +366,81 @@
 -yyyy%22);
+%0A    private static final String TITLE_FORMAT_TEMPLATE = %22EEE d%22;
 %0A%0A    pu
@@ -608,23 +608,37 @@
 oString(
-%22EEE d%22
+TITLE_FORMAT_TEMPLATE
 );%0A     

Extract date format to constant