use of com.iluwatar.observer.WeatherType in project java-design-patterns by iluwatar.
the class GWeatherTest method testTimePasses.
/**
* Verify if the weather passes in the order of the {@link WeatherType}s
*/
@Test
public void testTimePasses() {
final Race observer = mock(Race.class);
final GWeather weather = new GWeather();
weather.addObserver(observer);
final InOrder inOrder = inOrder(observer);
final WeatherType[] weatherTypes = WeatherType.values();
for (int i = 1; i < 20; i++) {
weather.timePasses();
inOrder.verify(observer).update(weather, weatherTypes[i % weatherTypes.length]);
}
verifyNoMoreInteractions(observer);
}
Aggregations