SerialNumberBasedEffectivityConfigSpec extends EffectivityConfigSpec { @Override protected boolean isEffective(Effectivity eff){ if(eff instanceof SerialNumberBasedEffectivity){ SerialNumberBasedEffectivity serialEff=(SerialNumberBasedEffectivity) eff; return isEffective(serialEff); }else return false; } SerialNumberBasedEffectivityConfigSpec(String number, ConfigurationItem configurationItem);  SerialNumberBasedEffectivityConfigSpec(String number, ProductConfiguration configuration); void setNumber(String number); String getNumber();  }
@Test public void isEffectiveTest(){ Whitebox.setInternalState(SNBECS,"configurationItem",tmp_CI); when(SNBE.getConfigurationItem()).thenReturn(configurationItem); boolean result = SNBECS.isEffective(SNBE); Assert.assertFalse(result); Whitebox.setInternalState(SNBECS,"configurationItem",configurationItem); when(SNBE.getStartNumber()).thenReturn("30"); result = SNBECS.isEffective(SNBE); Assert.assertFalse(result); Whitebox.setInternalState(SNBECS,"configurationItem",configurationItem); when(SNBE.getStartNumber()).thenReturn("15"); when(SNBE.getEndNumber()).thenReturn("15"); result = SNBECS.isEffective(SNBE); Assert.assertFalse(result); Whitebox.setInternalState(SNBECS,"configurationItem",configurationItem); when(SNBE.getStartNumber()).thenReturn("15"); when(SNBE.getEndNumber()).thenReturn("30"); result = SNBECS.isEffective(SNBE); Assert.assertTrue(result); result = SNBECS.isEffective(new DateBasedEffectivity()); Assert.assertFalse(result); }