@Test public void testGetDefaultWithNoLocalRepository() { ConfigDatabase database = mock(ConfigDatabase.class); when(database.get(anyString())).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION)); when(database.getGlobal(anyString())).thenReturn(Optional.of("value")); ConfigOp config = new ConfigOp(database); config.setScope(ConfigScope.DEFAULT).setAction(ConfigAction.CONFIG_GET) .setName("section.key").setValue(null).call(); }
@Test public void testGetDefaultWithNoLocalRepository() { ConfigDatabase database = mock(ConfigDatabase.class); when(database.get(anyString())).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION)); when(database.getGlobal(anyString())).thenReturn(Optional.of("value")); ConfigOp config = new ConfigOp(database); config.setScope(ConfigScope.DEFAULT).setAction(ConfigAction.CONFIG_GET) .setName("section.key").setValue(null).call(); }
@Test public void testGetLocalWithNoLocalRepository() { ConfigDatabase database = mock(ConfigDatabase.class); when(database.get(anyString())).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION)); ConfigOp config = new ConfigOp(database); exception.expect(ConfigException.class); config.setScope(ConfigScope.LOCAL).setAction(ConfigAction.CONFIG_GET).setName("section.key") .setValue(null).call(); }
@Test public void testGetLocalWithNoLocalRepository() { ConfigDatabase database = mock(ConfigDatabase.class); when(database.get(anyString())).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION)); ConfigOp config = new ConfigOp(database); exception.expect(ConfigException.class); config.setScope(ConfigScope.LOCAL).setAction(ConfigAction.CONFIG_GET).setName("section.key") .setValue(null).call(); }
@Test public void testListDefaultWithNoLocalRepository() { ConfigDatabase database = mock(ConfigDatabase.class); when(database.getAll()).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION)); ConfigOp config = new ConfigOp(database); config.setScope(ConfigScope.DEFAULT).setAction(ConfigAction.CONFIG_LIST).setName(null) .setValue(null).call(); }
@Test public void testListLocalWithNoLocalRepository() { ConfigDatabase database = mock(ConfigDatabase.class); when(database.getAll()).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION)); ConfigOp config = new ConfigOp(database); exception.expect(ConfigException.class); config.setScope(ConfigScope.LOCAL).setAction(ConfigAction.CONFIG_LIST).setName(null) .setValue(null).call(); }
@Test public void testListDefaultWithNoLocalRepository() { ConfigDatabase database = mock(ConfigDatabase.class); when(database.getAll()).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION)); ConfigOp config = new ConfigOp(database); config.setScope(ConfigScope.DEFAULT).setAction(ConfigAction.CONFIG_LIST).setName(null) .setValue(null).call(); }
@Test public void testListLocalWithNoLocalRepository() { ConfigDatabase database = mock(ConfigDatabase.class); when(database.getAll()).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION)); ConfigOp config = new ConfigOp(database); exception.expect(ConfigException.class); config.setScope(ConfigScope.LOCAL).setAction(ConfigAction.CONFIG_LIST).setName(null) .setValue(null).call(); }