### Question:
AbstractLocatorHandler implements LocatorHandler<T> { @Override public boolean present() { try { now(); } catch (TimeoutException | NoSuchElementException | StaleElementReferenceException e) { return false; } return loaded() && !isStale(); } 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 shouldReturnFalseInCaseOfTimeoutException() { TestLocatorHandler handler = spy(new TestLocatorHandler(mock(ElementLocator.class))); doThrow(TimeoutException.class).when(handler).now(); assertThat(handler.present()).isFalse(); }
@Test public void shouldReturnFalseInCaseOfNoSuchElementException() { TestLocatorHandler handler = spy(new TestLocatorHandler(mock(ElementLocator.class))); doThrow(NoSuchElementException.class).when(handler).now(); assertThat(handler.present()).isFalse(); }
@Test public void shouldReturnFalseInCaseOfStaleElementReferenceException() { TestLocatorHandler handler = spy(new TestLocatorHandler(mock(ElementLocator.class))); doThrow(StaleElementReferenceException.class).when(handler).now(); assertThat(handler.present()).isFalse(); }