### Question:
ServerFactoryUtil { static Optional<AbstractServerFactory> verifyAbstractServerFactory(ServerFactory serverFactory) { if (serverFactory instanceof AbstractServerFactory) { return Optional.of((AbstractServerFactory) serverFactory); } else if (serverFactory == null) { LOG.error( "Unable to apply secure server config. Expecting an AbstractServerFactory but found null"); } else { LOG.error( "Unable to apply secure server config. Expecting an AbstractServerFactory but found a {}", serverFactory.getClass()); } return Optional.empty(); } private  ServerFactoryUtil();   }### Answer:
@Test public void nullIsNotAbstractServerFactory() { Optional<AbstractServerFactory> actual = verifyAbstractServerFactory(null); assertThat(actual).isNotPresent(); }
@Test public void isAbstractServerFactory() { ServerFactory serverFactory = mock(AbstractServerFactory.class); Optional<AbstractServerFactory> actual = verifyAbstractServerFactory(serverFactory); assertThat(actual).isPresent(); }
@Test public void serverFactoryIsNotAbstractServerFactory() { ServerFactory serverFactory = mock(ServerFactory.class); Optional<AbstractServerFactory> actual = verifyAbstractServerFactory(serverFactory); assertThat(actual).isNotPresent(); }