@Test public void testPreservesOptions() { Fixture.fakePhase(PhaseId.READ_DATA); when(adapter.getFlavor()).thenReturn(NeedsPositionFlavor.CONTINUOUS); GeolocationOptions options = new GeolocationOptions().setFrequency(10).enableHighAccuracy().setMaximumAge(10); when(adapter.getOptions()).thenReturn(options); synchronizer.preserveValues(object); assertNotNull( RWT.getServiceStore() .getAttribute( synchronizer.getObjectId() + "." + GeolocationSynchronizer.PROP_ENABLE_HIGH_ACCURACY)); assertNotNull( RWT.getServiceStore() .getAttribute( synchronizer.getObjectId() + "." + GeolocationSynchronizer.PROP_FREQUENCY)); assertNotNull( RWT.getServiceStore() .getAttribute( synchronizer.getObjectId() + "." + GeolocationSynchronizer.PROP_MAXIMUM_AGE)); }
@Test public void testOptions() { GeolocationOptions mock = mock(GeolocationOptions.class); adapter.setOptions(mock); assertEquals(mock, adapter.getOptions()); }
@Test public void testRenderChanges() { Fixture.fakePhase(PhaseId.READ_DATA); when(adapter.getFlavor()).thenReturn(NeedsPositionFlavor.CONTINUOUS); GeolocationOptions options = new GeolocationOptions().setFrequency(10).enableHighAccuracy().setMaximumAge(10); when(adapter.getOptions()).thenReturn(options); synchronizer.renderChanges(object); verify(synchronizer) .renderProperty( eq(GeolocationSynchronizer.PROP_NEEDS_POSITION), any(NeedsPositionFlavor.class), any(NeedsPositionFlavor.class)); verify(synchronizer) .renderProperty( eq(GeolocationSynchronizer.PROP_MAXIMUM_AGE), any(Integer.class), any(Integer.class)); verify(synchronizer) .renderProperty( eq(GeolocationSynchronizer.PROP_FREQUENCY), any(Integer.class), any(Integer.class)); }