Example #1
0
 public void testSubstanceState() {
   AuState aus = new AuState(mau, historyRepo);
   assertEquals(SubstanceChecker.State.Unknown, aus.getSubstanceState());
   assertFalse(aus.hasNoSubstance());
   aus.setSubstanceState(SubstanceChecker.State.Yes);
   assertEquals(1, historyRepo.getAuStateStoreCount());
   assertEquals(SubstanceChecker.State.Yes, aus.getSubstanceState());
   assertFalse(aus.hasNoSubstance());
   aus.setSubstanceState(SubstanceChecker.State.No);
   assertEquals(2, historyRepo.getAuStateStoreCount());
   assertEquals(SubstanceChecker.State.No, aus.getSubstanceState());
   assertTrue(aus.hasNoSubstance());
   assertNotEquals("2", aus.getFeatureVersion(Plugin.Feature.Substance));
   mplug.setFeatureVersionMap(MapUtil.map(Plugin.Feature.Substance, "2"));
   aus.setSubstanceState(SubstanceChecker.State.Yes);
   // changing both the substance state and feature version should store
   // only once
   assertEquals(3, historyRepo.getAuStateStoreCount());
   assertEquals(SubstanceChecker.State.Yes, aus.getSubstanceState());
   assertEquals("2", aus.getFeatureVersion(Plugin.Feature.Substance));
 }