### Question:
AbstractLocatorHandler implements LocatorHandler<T> { public String proxyToString(String elementToString) { if (elementToString == null) { elementToString = getLazyToString(); } return locator instanceof WrapsElement ? elementToString : locator + " (" + elementToString + ")"; } AbstractLocatorHandler(ElementLocator locator); @Override boolean addListener(ProxyElementListener listener); @Override boolean removeListener(ProxyElementListener listener); @Override T getLocatorResult(); @Override void setHooks(HookChainBuilder hookChainBuilder, List<HookDefinition<?>> hookDefinitions); @Override ElementLocator getLocator(); @Override ElementLocator getHookLocator(); @Override boolean loaded(); @Override boolean present(); @Override void reset(); void setProxy(T proxy); abstract T getLocatorResultImpl(); String proxyToString(String elementToString);  }### Answer:
@Test public void shouldReturnLocatorSpecificDefaultToStringIfElementToStringIsNull() { ElementLocator elementLocator = mock(ElementLocator.class, withSettings().extraInterfaces(WrapsElement.class)); TestLocatorHandler handler = new TestLocatorHandler(elementLocator); assertThat(handler.proxyToString(null)).isEqualTo("Lazy Element"); }
@Test public void shouldReturnDefaultToStringIfElementToStringIsNull() { assertThat(locatorHandler.proxyToString(null)).isEqualTo("locator (Lazy Element)"); }
@Test public void shouldReturnLocatorSpecificDefaultToStringWithElementToString() { ElementLocator elementLocator = mock(ElementLocator.class, withSettings().extraInterfaces(WrapsElement.class)); TestLocatorHandler handler = new TestLocatorHandler(elementLocator); assertThat(handler.proxyToString("some to string")).isEqualTo("some to string"); }
@Test public void shouldReturnCustomToStringIfElementToStringWithElementToString() { assertThat(locatorHandler.proxyToString("some to string")).isEqualTo("locator (some to string)"); }