### Question:
Weather { public void timePasses() { var enumValues = WeatherType.values(); currentWeather = enumValues[(currentWeather.ordinal() + 1) % enumValues.length]; LOGGER.info("The weather changed to {}.", currentWeather); notifyObservers(); } Weather(); void addObserver(WeatherObserver obs); void removeObserver(WeatherObserver obs); void timePasses();  }### Answer:
@Test public void testTimePasses() { final var observer = mock(WeatherObserver.class); final var weather = new Weather(); weather.addObserver(observer); final var inOrder = inOrder(observer); final var weatherTypes = WeatherType.values(); for (var i = 1; i < 20; i++) { weather.timePasses(); inOrder.verify(observer).update(weatherTypes[i % weatherTypes.length]); } verifyNoMoreInteractions(observer); }