@Test public void testResolveDirectIdFound() { Element expected = createMock(Element.class); replay(expected); Screen screen = createMock(Screen.class); expect(screen.findElementById("id")).andReturn(expected); replay(screen); TargetElementResolver resolver = new TargetElementResolver(screen, baseElement); assertEquals(expected, resolver.resolve("id")); verify(screen); verify(expected); }
@Nullable public Element resolve(@Nullable final String id) { if (id == null) { return null; } if (id.startsWith(PARENT)) { return resolveParents(id, base.getParent()); } if (id.startsWith("#")) { return base.findElementById(id); } return screen.findElementById(id); }
TargetElementResolver { @Nullable public Element resolve(@Nullable final String id) { if (id == null) { return null; } if (id.startsWith(PARENT)) { return resolveParents(id, base.getParent()); } if (id.startsWith("#")) { return base.findElementById(id); } return screen.findElementById(id); } }
TargetElementResolver { @Nullable public Element resolve(@Nullable final String id) { if (id == null) { return null; } if (id.startsWith(PARENT)) { return resolveParents(id, base.getParent()); } if (id.startsWith("#")) { return base.findElementById(id); } return screen.findElementById(id); } TargetElementResolver(@Nonnull final Screen screen, @Nonnull final Element baseElement); }
TargetElementResolver { @Nullable public Element resolve(@Nullable final String id) { if (id == null) { return null; } if (id.startsWith(PARENT)) { return resolveParents(id, base.getParent()); } if (id.startsWith("#")) { return base.findElementById(id); } return screen.findElementById(id); } TargetElementResolver(@Nonnull final Screen screen, @Nonnull final Element baseElement); @Nullable Element resolve(@Nullable final String id); }
TargetElementResolver { @Nullable public Element resolve(@Nullable final String id) { if (id == null) { return null; } if (id.startsWith(PARENT)) { return resolveParents(id, base.getParent()); } if (id.startsWith("#")) { return base.findElementById(id); } return screen.findElementById(id); } TargetElementResolver(@Nonnull final Screen screen, @Nonnull final Element baseElement); @Nullable Element resolve(@Nullable final String id);  }