- Timestamp:
- 12/18/24 13:28:59 (4 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
domaineditor/src/test/java/geniusweb/model/NumberValueSetModelTest.java
r52 r53 11 11 import org.junit.Test; 12 12 13 import geniusweb.domaineditor.ProfileEditor; 13 14 import geniusweb.domaineditor.model.NumberValueSetModel; 14 15 import geniusweb.issuevalue.NumberValueSet; 15 16 import geniusweb.issuevalue.ValueSet; 16 17 import tudelft.utilities.immutablelist.Range; 18 import tudelft.utilities.listener.Unacceptable; 17 19 import tudelft.utilities.logging.Reporter; 18 20 import tudelft.utilities.mvc.model.NumberModel; … … 22 24 23 25 @Test 24 public void smoke() {26 public void smoke() throws Unacceptable { 25 27 new NumberValueSetModel(log); 26 28 } 27 29 28 30 @Test 29 public void testSomeGoodValues() {31 public void testSomeGoodValues() throws Unacceptable { 30 32 NumberValueSetModel model = new NumberValueSetModel(log); 31 33 assertEquals(11, model.getList().getSize()); // default is 0...10 … … 33 35 assertEquals(9, model.getList().getSize()); // 2..10 34 36 model.getHigh().setValue(new BigDecimal("3")); 37 assertEquals(2, model.getLow().getValue().intValue()); 38 assertEquals(3, model.getHigh().getValue().intValue()); 35 39 assertEquals(2, model.getList().getSize()); // 2..3 36 40 model.getStep().setValue(new BigDecimal("0.1")); … … 38 42 } 39 43 40 @Test(expected = IllegalStateException.class) 41 public void testIllegal1() { 42 new NumberValueSetModel(new NumberModel(BigDecimal.TEN, log), 43 new NumberModel(BigDecimal.ONE, log), 44 new NumberModel(BigDecimal.ONE, log), log); 44 @Test(expected = Unacceptable.class) 45 public void testIllegal1() throws Unacceptable { 46 new NumberValueSetModel( 47 new NumberModel(BigDecimal.TEN, log, ProfileEditor.TIME), 48 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), 49 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), log); 45 50 } 46 51 47 52 @Test 48 public void testIllegal12() {53 public void testIllegal12() throws Unacceptable { 49 54 NumberValueSetModel n = new NumberValueSetModel(log); 50 55 // change low above high must log problem … … 53 58 } 54 59 55 @Test(expected = IllegalStateException.class)56 public void testIllegal3() {60 @Test(expected = Unacceptable.class) 61 public void testIllegal3() throws Unacceptable { 57 62 NumberValueSetModel model = new NumberValueSetModel( 58 new NumberModel(BigDecimal.TEN, log ),59 new NumberModel(BigDecimal.ONE, log ),60 new NumberModel(BigDecimal.ONE, log ), log);63 new NumberModel(BigDecimal.TEN, log, ProfileEditor.TIME), 64 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), 65 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), log); 61 66 model.getLow().setValue(BigDecimal.valueOf(20)); 62 67 } 63 68 64 69 @Test 65 public void testLowIncrease() {70 public void testLowIncrease() throws Unacceptable { 66 71 NumberValueSetModel set = new NumberValueSetModel( 67 new NumberModel(BigDecimal.ZERO, log ),68 new NumberModel(BigDecimal.TEN, log ),69 new NumberModel(BigDecimal.ONE, log ), log);72 new NumberModel(BigDecimal.ZERO, log, ProfileEditor.TIME), 73 new NumberModel(BigDecimal.TEN, log, ProfileEditor.TIME), 74 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), log); 70 75 ValueSet v = new NumberValueSet( 71 76 new Range(BigDecimal.ONE, BigDecimal.TEN, BigDecimal.ONE)); … … 75 80 76 81 @Test 77 public void testHighDecrease() {82 public void testHighDecrease() throws Unacceptable { 78 83 NumberValueSetModel set = new NumberValueSetModel( 79 new NumberModel(BigDecimal.ZERO, log ),80 new NumberModel(BigDecimal.TEN, log ),81 new NumberModel(BigDecimal.ONE, log ), log);84 new NumberModel(BigDecimal.ZERO, log, ProfileEditor.TIME), 85 new NumberModel(BigDecimal.TEN, log, ProfileEditor.TIME), 86 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), log); 82 87 ValueSet v = new NumberValueSet( 83 88 new Range(BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.ONE)); … … 87 92 88 93 @Test 89 public void testIncreaseBoth() {94 public void testIncreaseBoth() throws Unacceptable { 90 95 NumberValueSetModel set = new NumberValueSetModel( 91 new NumberModel(BigDecimal.ZERO, log ),92 new NumberModel(BigDecimal.ONE, log ),93 new NumberModel(BigDecimal.ONE, log ), log);96 new NumberModel(BigDecimal.ZERO, log, ProfileEditor.TIME), 97 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), 98 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), log); 94 99 ValueSet v = new NumberValueSet( 95 100 new Range(BigDecimal.ONE, BigDecimal.TEN, BigDecimal.ONE)); … … 98 103 99 104 @Test 100 public void testIncreaseBothMuch() {105 public void testIncreaseBothMuch() throws Unacceptable { 101 106 NumberValueSetModel set = new NumberValueSetModel( 102 new NumberModel(BigDecimal.ZERO, log ),103 new NumberModel(BigDecimal.ONE, log ),104 new NumberModel(BigDecimal.ONE, log ), log);107 new NumberModel(BigDecimal.ZERO, log, ProfileEditor.TIME), 108 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), 109 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), log); 105 110 ValueSet v = new NumberValueSet(new Range(new BigDecimal("20"), 106 111 new BigDecimal("80"), BigDecimal.ONE)); … … 109 114 110 115 @Test 111 public void testDecreaseBoth() {116 public void testDecreaseBoth() throws Unacceptable { 112 117 NumberValueSetModel set = new NumberValueSetModel( 113 new NumberModel(BigDecimal.ONE, log ),114 new NumberModel(BigDecimal.TEN, log ),115 new NumberModel(BigDecimal.ONE, log ), log);118 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), 119 new NumberModel(BigDecimal.TEN, log, ProfileEditor.TIME), 120 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), log); 116 121 ValueSet v = new NumberValueSet( 117 122 new Range(BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.ONE)); … … 120 125 121 126 @Test 122 public void testDecreaseBothMuch() {127 public void testDecreaseBothMuch() throws Unacceptable { 123 128 NumberValueSetModel set = new NumberValueSetModel( 124 new NumberModel(new BigDecimal("20"), log ),125 new NumberModel(new BigDecimal("80"), log ),126 new NumberModel(BigDecimal.ONE, log ), log);129 new NumberModel(new BigDecimal("20"), log, ProfileEditor.TIME), 130 new NumberModel(new BigDecimal("80"), log, ProfileEditor.TIME), 131 new NumberModel(BigDecimal.ONE, log, ProfileEditor.TIME), log); 127 132 ValueSet v = new NumberValueSet( 128 133 new Range(BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.ONE));
Note:
See TracChangeset
for help on using the changeset viewer.