TalkFromFile implements Function<File, Talk> { @Override public Talk apply(File input) { Properties props = read(input); String speakerValue = props.getProperty("speaker"); String title = props.getProperty("title"); String dateValue = props.getProperty("date"); String contents = props.getProperty("content"); String categoriesValue = props.getProperty("categories"); String organizer = props.getProperty("organizer", ""); List<String> speakers = Arrays.asList(speakerValue.split(",")); List<String> categories = Collections.emptyList(); if (categoriesValue != null) { categories = Arrays.asList(categoriesValue.split(",")); } return new Talk(input.getAbsolutePath(), title, speakers, parseDate(dateValue), contents, categories, organizer); }  @Override Talk apply(File input);  }
@Test public void valuesAreSet() throws ParseException { Talk talk = talkFromFile.apply(new File(path)); assertEquals("Florian Hopf", talk.speakers.get(0)); assertEquals("Titel", talk.title); assertEquals(path, talk.path); assertEquals("Inhalt", talk.content); Date date = new SimpleDateFormat("dd.MM.yyyy").parse("12.06.2012"); assertEquals(date, talk.date); }