### Question:
DBMSModule implements ServerModule { @Override public void start() { webServer.addJAXRSClasses( singletonList( DiscoveryService.class.getName() ), ROOT_PATH, singletonList( injectable( DiscoverableURIs.class, discoverableURIs.get() ) ) ); webServer.addJAXRSClasses( getClassNames(), ROOT_PATH, null ); } DBMSModule( WebServer webServer, Config config, Supplier<DiscoverableURIs> discoverableURIs ); @Override void start(); @Override void stop();  }### Answer:
@SuppressWarnings( "unchecked" ) @Test public void shouldRegisterAtRootByDefault() throws Exception { WebServer webServer = mock( WebServer.class ); Config config = mock( Config.class ); CommunityNeoServer neoServer = mock( CommunityNeoServer.class ); when( neoServer.baseUri() ).thenReturn( new URI( "http: when( neoServer.getWebServer() ).thenReturn( webServer ); when( config.get( GraphDatabaseSettings.auth_enabled ) ).thenReturn( true ); DBMSModule module = new DBMSModule( webServer, config, () -> new DiscoverableURIs.Builder().build() ); module.start(); verify( webServer ).addJAXRSClasses( anyList(), anyString(), isNull() ); }
@SuppressWarnings( "unchecked" ) @Test public void shouldNotRegisterUserServiceWhenAuthDisabled() throws Exception { WebServer webServer = mock( WebServer.class ); Config config = mock( Config.class ); CommunityNeoServer neoServer = mock( CommunityNeoServer.class ); when( neoServer.baseUri() ).thenReturn( new URI( "http: when( neoServer.getWebServer() ).thenReturn( webServer ); when( config.get( GraphDatabaseSettings.auth_enabled ) ).thenReturn( false ); DBMSModule module = new DBMSModule( webServer, config, () -> new DiscoverableURIs.Builder().build() ); module.start(); verify( webServer ).addJAXRSClasses( anyList(), anyString(), isNull() ); verify( webServer, never() ).addJAXRSClasses( argThat( new ArgumentMatcher<List<String>>() { @Override public boolean matches( List<String> argument ) { return argument.contains( UserService.class.getName() ); } public String toString() { return "<List containing " + UserService.class.getName() + ">"; } } ), anyString(), anyCollection() ); }