/** Test of canBeFired method, of class edu.uj.petri.model.NormalArc. */ public void testCanBeFired() { System.out.println("canBeFired"); Place place = createPlace(); Transition transition = createTransition(); NormalArc instance = new NormalArc(place, transition, new NormalArcObjectImpl(model)); place.setTokens(4); instance.setWeight(1); boolean expResult = true; boolean result = instance.canBeFired(); assertEquals(expResult, result); instance.setWeight(4); expResult = true; result = instance.canBeFired(); assertEquals(expResult, result); instance.setWeight(5); expResult = false; result = instance.canBeFired(); assertEquals(expResult, result); instance = new NormalArc(transition, place, new NormalArcObjectImpl(model)); place.setTokens(0); expResult = true; result = instance.canBeFired(); assertEquals(expResult, result); }
/** Test of fire method, of class edu.uj.petri.model.NormalArc. */ public void testFire() { System.out.println("fire"); Place place = createPlace(); Transition transition = createTransition(); NormalArc instance = new NormalArc(place, transition, new NormalArcObjectImpl(model)); place.setTokens(4); instance.setWeight(1); instance.fire(); int expTokens = 3; int tokens = place.getTokens(); assertEquals(expTokens, tokens); instance.setWeight(2); instance.fire(); expTokens = 1; tokens = place.getTokens(); assertEquals(expTokens, tokens); instance = new NormalArc(transition, place, new NormalArcObjectImpl(model)); place.setTokens(0); instance.setWeight(2); instance.fire(); expTokens = 2; tokens = place.getTokens(); assertEquals(expTokens, tokens); instance.setWeight(1); instance.fire(); expTokens = 3; tokens = place.getTokens(); assertEquals(expTokens, tokens); }