1 15 package org.apache.hivemind; 16 17 import org.apache.hivemind.definition.Occurances; 18 19 import junit.framework.TestCase; 20 21 27 public class TestOccurances extends TestCase 28 { 29 public void testNone() 30 { 31 Occurances o = Occurances.NONE; 32 33 assertEquals(true, o.inRange(0)); 34 assertEquals(false, o.inRange(1)); 35 } 36 37 public void testOnePlus() 38 { 39 Occurances o = Occurances.ONE_PLUS; 40 assertEquals(false, o.inRange(0)); 41 assertEquals(true, o.inRange(1)); 42 assertEquals(true, o.inRange(2)); 43 } 44 45 public void testRequired() 46 { 47 Occurances o = Occurances.REQUIRED; 48 49 assertEquals(false, o.inRange(0)); 50 assertEquals(true, o.inRange(1)); 51 assertEquals(false, o.inRange(2)); 52 } 53 54 public void testUnbounded() 55 { 56 Occurances o = Occurances.UNBOUNDED; 57 58 assertEquals(true, o.inRange(0)); 59 assertEquals(true, o.inRange(1)); 60 assertEquals(true, o.inRange(2)); 61 } 62 63 public void testOptional() 64 { 65 Occurances o = Occurances.OPTIONAL; 66 67 assertEquals(true, o.inRange(0)); 68 assertEquals(true, o.inRange(1)); 69 assertEquals(false, o.inRange(2)); 70 } 71 } 72 | Popular Tags |