BeekeeperServiceImpl implements BeekeeperService { @Override public long ancestorsOfDroneAt(int generation) { if (generation <= 0) { return 0; } return fibonacciCalculator.term(generation + 1); } BeekeeperServiceImpl(FibonacciCalculator fibonacciCalculator); @Override long ancestorsOfDroneAt(int generation); @Override long ancestorsOfQueenAt(int generation);  }
@Test public void calculatesAncestorsOfDroneAtGenerationN() { when(fibonacciCalculator.term(generation + 1)).thenReturn(fibonacciValue); long ancestors = beekeeperService.ancestorsOfDroneAt(generation); assertThat(ancestors).isEqualTo(fibonacciValue); }