### Question:
ReviewDateHeaderListTransformer { List<Object> transform() { final ArrayList<Object> objects = new ArrayList<Object>(kinoDtos); String currentYear = null; SortedMap<Integer, String> yearsToInsert = new TreeMap<>(); int indexOfObjet = 0; for (Object object : objects) { String releaseDateYear = String.valueOf(getYearFromReviewDate(((KinoDto) object).getReview_date())); if (!releaseDateYear.equals(currentYear)) { yearsToInsert.put(indexOfObjet, releaseDateYear); currentYear = releaseDateYear; } indexOfObjet++; } int offset = 0; for (Integer index : yearsToInsert.keySet()) { String yearToInsert = yearsToInsert.get(index); objects.add(index + offset, yearToInsert); ++offset; } return objects; } ReviewDateHeaderListTransformer(Context context, List<KinoDto> kinoDtos);   }### Answer:
@Test public void transformListWithOneKino() { assertEquals( new ArrayList<Object>() {{ add("2018"); add(aKino); }}, new ReviewDateHeaderListTransformer(context, new ArrayList<KinoDto>() {{ add(aKino); }}).transform() ); }
@Test public void transformListWithSeveralKinos() throws ParseException { doReturn("Année inconnue").when(context).getString(R.string.unknown_year); final KinoDto anotherKino = mock(KinoDto.class); final KinoDto aThirdKino = mock(KinoDto.class); final KinoDto aFourthKino = mock(KinoDto.class); doReturn(getDateForYear("2015")).when(anotherKino).getReview_date(); doReturn(getDateForYear("2015")).when(aThirdKino).getReview_date(); doReturn(null).when(aFourthKino).getReview_date(); assertEquals( new ArrayList<Object>() {{ add("2018"); add(aKino); add("2015"); add(anotherKino); add(aThirdKino); add("Année inconnue"); add(aFourthKino); }}, new ReviewDateHeaderListTransformer(context, new ArrayList<KinoDto>() {{ add(aKino); add(anotherKino); add(aThirdKino); add(aFourthKino); }}).transform() ); }