### Question:
ScreenToGeo implements Observer, ViewChangeListener { @Override public void viewChanged(Viewer viewer, ViewChangeType type) { if (ViewChangeType.WINDOW_RESIZE != type) { calculateGeosInBackground(); } } ScreenToGeo(MapManager mapManager, XrayGogglesModel model); void close(); @Override void update(Observable o, Object arg); @Override void viewChanged(Viewer viewer, ViewChangeType type);  }### Answer:
@Test public void testViewChanged() throws InterruptedException { EasyMockSupport support = new EasyMockSupport(); MapManager mapManager = createMapManager(support); EasyMock.expect(mapManager.convertToPosition(EasyMock.isA(Vector2i.class), EasyMock.eq(ReferenceLevel.TERRAIN))) .andAnswer(() -> { Vector2i screen = (Vector2i)EasyMock.getCurrentArguments()[0]; LatLonAlt latLon = LatLonAlt.createFromDegrees(20 + screen.getY(), 20 + screen.getX()); return new GeographicPosition(latLon); }).times(5); support.replayAll(); XrayGogglesModel model = new XrayGogglesModel(); model.setScreenPosition(new ScreenPosition(0, 0), new ScreenPosition(1, 0), new ScreenPosition(0, 1), new ScreenPosition(1, 1)); myLatch = new CountDownLatch(1); model.addObserver(this); ScreenToGeo screenToGeo = new ScreenToGeo(mapManager, model); assertTrue(myLatch.await(1, TimeUnit.SECONDS)); assertEquals(new Vector2d(10, 10), model.getUpperLeftGeo().asVector2d()); assertEquals(new Vector2d(11, 10), model.getUpperRightGeo().asVector2d()); assertEquals(new Vector2d(10, 11), model.getLowerLeftGeo().asVector2d()); assertEquals(new Vector2d(11, 11), model.getLowerRightGeo().asVector2d()); myLatch = new CountDownLatch(1); mapManager.getViewChangeSupport().notifyViewChangeListeners(null, (r) -> { r.run(); }, ViewChangeType.VIEW_CHANGE); assertTrue(myLatch.await(1, TimeUnit.SECONDS)); assertEquals(new Vector2d(20, 20), model.getUpperLeftGeo().asVector2d()); assertEquals(new Vector2d(21, 20), model.getUpperRightGeo().asVector2d()); assertEquals(new Vector2d(20, 21), model.getLowerLeftGeo().asVector2d()); assertEquals(new Vector2d(21, 21), model.getLowerRightGeo().asVector2d()); screenToGeo.close(); mapManager.getViewChangeSupport().notifyViewChangeListeners(null, (r) -> { r.run(); }, ViewChangeType.VIEW_CHANGE); Thread.sleep(500); support.verifyAll(); }