Tuesday, December 27, 2016

Happy New Year 2017!!!

class HappyNewYearWishes {
   private YearFactory yearFactory = new YearFactory();
   private BlogRepository blogRepository = new BlogRepository();
   private YearRepository yearRepository = new YearRepository();

   @Test
   public void youShouldMakeAllWishesComeTrue() {
      Year year2017 = yearFactory.aNewYear(2017);
      Person you = blogRepository.findAllReadersOf("Let's talk about Java").you();

      you.acceptChallengesOf(year2017);

      assertThat(you.allGoalsOf(year2017).achieved()).isTrue();
      assertThat(you.didLearnSomethingNewIn(year2017)).isTrue();
      assertThat(you.booksReadIn(year2017).count()).isGreaterThan(you.booksReadIn(aYear(2016)).count());
      assertThat(you.currentJob().isGreat()).isTrue();
      assertThat(you.currentSalary()).isGreaterThan(you.salaryIn(aYear(2016)));
      assertThat(you.wantMoreIn(aYear(2018))).isTrue();
   }

   private Year aYear(int year) {
      return yearRepository.find(year);
   }
}