### Question:
XrayWindow extends DefaultTransformer implements Observer { @Override public void open() { super.open(); publishUnpublishWindow(); myModel.addObserver(this); } XrayWindow(DataRegistry dataRegistry, XrayGogglesModel model); @Override void close(); @Override void open(); @Override void update(Observable o, Object arg);  }### Answer:
@Test public void test() { EasyMockSupport support = new EasyMockSupport(); DataRegistry registry = support.createMock(DataRegistry.class); GenericSubscriber<Geometry> receiver = createSubscriber(support); support.replayAll(); XrayGogglesModel model = new XrayGogglesModel(); XrayWindow window = new XrayWindow(registry, model); model.setScreenPosition(new ScreenPosition(10, 11), new ScreenPosition(11, 11), new ScreenPosition(10, 10), new ScreenPosition(11, 10)); window.addSubscriber(receiver); window.open(); assertEquals(1, myGeometries.size()); assertEquals(model.getWindowGeometry(), myGeometries.iterator().next()); PolylineGeometry geometry = (PolylineGeometry)myGeometries.get(0); assertEquals(5, geometry.getVertices().size()); assertEquals(model.getUpperLeft().asVector2d(), geometry.getVertices().get(0).asVector2d()); assertEquals(model.getUpperRight().asVector2d(), geometry.getVertices().get(1).asVector2d()); assertEquals(model.getLowerRight().asVector2d(), geometry.getVertices().get(2).asVector2d()); assertEquals(model.getLowerLeft().asVector2d(), geometry.getVertices().get(3).asVector2d()); assertEquals(model.getUpperLeft().asVector2d(), geometry.getVertices().get(4).asVector2d()); model.setScreenPosition(new ScreenPosition(20, 21), new ScreenPosition(21, 21), new ScreenPosition(20, 20), new ScreenPosition(21, 20)); assertEquals(1, myGeometries.size()); assertEquals(model.getWindowGeometry(), myGeometries.iterator().next()); geometry = (PolylineGeometry)myGeometries.get(0); assertEquals(5, geometry.getVertices().size()); assertEquals(model.getUpperLeft().asVector2d(), geometry.getVertices().get(0).asVector2d()); assertEquals(model.getUpperRight().asVector2d(), geometry.getVertices().get(1).asVector2d()); assertEquals(model.getLowerRight().asVector2d(), geometry.getVertices().get(2).asVector2d()); assertEquals(model.getLowerLeft().asVector2d(), geometry.getVertices().get(3).asVector2d()); assertEquals(model.getUpperLeft().asVector2d(), geometry.getVertices().get(4).asVector2d()); model.setScreenPosition(null, null, null, null); assertTrue(myGeometries.isEmpty()); assertNull(model.getWindowGeometry()); support.verifyAll(); }