SimpleRequestHandler { public final void init(@Nonnull Application application) { requireNonNull(application); init(new JRestlessHandlerContainer<>(application, createBinder())); }  final void init(@Nonnull Application application); final void init(@Nonnull Application application, @Nullable Object parentManager); final void init(@Nonnull JRestlessHandlerContainer<JRestlessContainerRequest> handlerContainer); final void start(); final void stop(); final ResponseT delegateRequest(@Nonnull RequestT request);  }
@Test public void stop_NotStarted_ShouldThrowIse() { SimpleRequestHandlerImpl customHandler = null; try { customHandler = new SimpleRequestHandlerImpl(); customHandler.init(container); } catch (Exception e) { throw new RuntimeException(e); } assertThrows(IllegalStateException.class, customHandler::stop); }
@Test public void init0_NullAppGiven_ShouldThrowNpe() { assertThrows(NullPointerException.class, () -> new SimpleRequestHandlerImpl().init((Application) null)); }
@Test public void init1_NullAppGiven_ShouldThrowNpe() { assertThrows(NullPointerException.class, () -> new SimpleRequestHandlerImpl().init((Application) null, "")); }
@Test public void init1_NullServiceLocatorGiven_ShouldNotThrowNpe() { new SimpleRequestHandlerImpl().init(mock(Application.class), null); }
@Test public void init2_NullHandlerContainerGiven_ShouldThrowNpe() { assertThrows(NullPointerException.class, () -> new SimpleRequestHandlerImpl().init((JRestlessHandlerContainer<JRestlessContainerRequest>) null)); }
@Test public void init2_MultiInit_ShouldThrowIse() { assertThrows(IllegalStateException.class, () -> handler.init(container)); }