### Question:
Desktop { @SuppressWarnings("unchecked") public <T extends Window> T windowFor(final Specification spec) { final T window = (T) world.actorFor(spec.protocol, spec.definition); window.createSelf(spec); return window; } private  Desktop(); @SuppressWarnings("unchecked") T windowFor(final Specification spec); static final Desktop instance; }### Answer:
@Test public void testThatDesktopCreatesWindow() { final MockParent parent = new MockParent(); final Specification childSpec = Button.with(parent, "Ok", new Rectangle(), true); final Button button = Desktop.instance.windowFor(childSpec); assertNotNull(button); parent.nextEvent(); button.click(); final Button.Clicked clicked = parent.nextEvent(); assertEquals(Point.home(), clicked.point); }