@Test public void testGetBooleanValueUnexpectedText() throws Exception { ScopeExtDO value = Mockito.mock(ScopeExtDO.class); Mockito.when(value.getValue()).thenReturn("foobar"); Mockito.when( scopeExtDao.getLowestExistingConfigurationItem( Matchers.any(Long.class), Matchers.anyString())) .thenReturn(null); Boolean booleanValue = configService.isBooleanActive(null, null, null); Assert.assertFalse("Boolean values should be false if ext value is not 'true'.", booleanValue); }
@Test public void testGetBooleanNull() throws Exception { ScopeExtDO value = Mockito.mock(ScopeExtDO.class); Mockito.when(value.getValue()).thenReturn(null); Mockito.when( scopeExtDao.getLowestExistingConfigurationItem( Matchers.any(Long.class), Matchers.anyString())) .thenReturn(null); Boolean booleanValue = configService.isBooleanActive(null, null, null); Assert.assertFalse("Boolean values should default to false.", booleanValue); }