ResolutionProvider { public Resolution increase() { currentPosition = ++currentPosition % resolutions.size(); return resolutions.get(currentPosition); } ResolutionProvider(List<Graphics.DisplayMode> displayModes); Resolution increase(); Resolution getResolution();  }
@Test public void testIncreaseReturnsResolutionForSingleDisplayMode() { resolutionProvider = new ResolutionProvider(Collections.singletonList(new TestDisplayMode(100, 50))); Resolution resolution = resolutionProvider.increase(); assertResolution(resolution, 100, 50); }
@Test public void testIncreaseCirclesThroughAllResolutions() { resolutionProvider = new ResolutionProvider(Arrays.asList(new TestDisplayMode(100, 50), new TestDisplayMode(200, 100))); assertResolution(resolutionProvider.increase(), 200, 100); assertResolution(resolutionProvider.increase(), 100, 50); assertResolution(resolutionProvider.increase(), 200, 100); assertResolution(resolutionProvider.increase(), 100, 50); }
@Test public void testOrderOfResolutions() { resolutionProvider = new ResolutionProvider(Arrays.asList(new TestDisplayMode(100, 100), new TestDisplayMode(1000, 100), new TestDisplayMode(100, 50))); assertResolution(resolutionProvider.increase(), 100, 100); assertResolution(resolutionProvider.increase(), 1000, 100); assertResolution(resolutionProvider.increase(), 100, 50); }