Changeset 53 for domaineditor/src/test/java/geniusweb
- Timestamp:
- 12/18/24 13:28:59 (4 days ago)
- Location:
- domaineditor/src/test/java/geniusweb
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
domaineditor/src/test/java/geniusweb/domaineditor/DomainEditorPanelTest.java
r52 r53 12 12 import geniusweb.domaineditor.model.ValueSetModel; 13 13 import geniusweb.domaineditor.panels.DomainEditorPanel; 14 import tudelft.utilities.listener. Listener;14 import tudelft.utilities.listener.ThrowingListener; 15 15 import tudelft.utilities.logging.Reporter; 16 16 import tudelft.utilities.mvc.model.DefaultMapModel; … … 28 28 f.setLayout(new BorderLayout()); 29 29 30 StringModel namemodel = new StringModel("issue1", log); 30 StringModel namemodel = new StringModel("issue1", log, 31 ProfileEditor.TIME); 31 32 ValueSetModel valuesmmodel = new DiscreteValueSetModel(log); 32 33 DefaultMapModel<StringModel, ValueSetModel> issuesmodel = new DefaultMapModel<StringModel, ValueSetModel>( 33 Collections.singletonMap(namemodel, valuesmmodel), log) { 34 Collections.singletonMap(namemodel, valuesmmodel), log, 35 ProfileEditor.TIME) { 34 36 35 37 @Override … … 50 52 51 53 }; 52 DomainModel model = new DomainModel(new StringModel("testdomain", log), 54 DomainModel model = new DomainModel( 55 new StringModel("testdomain", log, ProfileEditor.TIME), 53 56 issuesmodel, log); 54 model.addListener(new Listener<Event>() {57 model.addListener(new ThrowingListener<Event>() { 55 58 56 59 @Override -
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)); -
domaineditor/src/test/java/geniusweb/panels/ComboBoxTest.java
r52 r53 14 14 import org.junit.Test; 15 15 16 import geniusweb.domaineditor.ProfileEditor; 16 17 import geniusweb.domaineditor.model.DiscreteValueSetModel; 17 18 import geniusweb.domaineditor.model.DomainModel; … … 32 33 public void GuiTest() throws InterruptedException { 33 34 34 StringModel a = new StringModel("apples", log );35 StringModel b = new StringModel("bears", log );36 StringModel c = new StringModel("carrots", log );35 StringModel a = new StringModel("apples", log, ProfileEditor.TIME); 36 StringModel b = new StringModel("bears", log, ProfileEditor.TIME); 37 StringModel c = new StringModel("carrots", log, ProfileEditor.TIME); 37 38 38 39 JFrame f = new JFrame(); … … 40 41 f.getContentPane().add(panel); 41 42 DefaultListModel<StringModel> model = new DefaultListModel( 42 Arrays.asList(a, b, c), log) { 43 44 }; 43 Arrays.asList(a, b, c), log, ProfileEditor.TIME); 45 44 DefaultSelectionModel<StringModel> selectionmodel1 = new DefaultSelectionModel( 46 model );45 model, log, true); 47 46 panel.add(new ComboBox<StringModel>(selectionmodel1), 48 47 BorderLayout.NORTH); … … 60 59 public void testEqualsDeep() { 61 60 62 StringModel redvalue = new StringModel("red", log); 63 StringModel greenvalue = new StringModel("green", log); 61 StringModel redvalue = new StringModel("red", log, ProfileEditor.TIME); 62 StringModel greenvalue = new StringModel("green", log, 63 ProfileEditor.TIME); 64 64 DiscreteValueSetModel issue1values = new DiscreteValueSetModel( 65 65 Arrays.asList(redvalue, greenvalue), log); 66 66 67 StringModel issue1 = new StringModel("issue", log );67 StringModel issue1 = new StringModel("issue", log, ProfileEditor.TIME); 68 68 69 SelectionModel issue1valuessel = new DefaultSelectionModel( 70 issue1values);69 SelectionModel issue1valuessel = new DefaultSelectionModel(issue1values, 70 log, true); 71 71 Map<StringModel, SelectionModel> a = Collections.singletonMap(issue1, 72 72 issue1valuessel); 73 73 DefaultMapModel<StringModel, SelectionModel> issuevalues = new DefaultMapModel<StringModel, SelectionModel>( 74 a, log ) {74 a, log, ProfileEditor.TIME) { 75 75 76 76 @Override … … 92 92 93 93 MapModel<StringModel, ValueSetModel> issuevaluesmodel = new DefaultMapModel<StringModel, ValueSetModel>( 94 Collections.singletonMap(issue1, issue1values), log) { 94 Collections.singletonMap(issue1, issue1values), log, 95 ProfileEditor.TIME) { 95 96 96 97 @Override … … 110 111 111 112 }; 112 DomainModel domain = new DomainModel(new StringModel("testdomain", log), 113 DomainModel domain = new DomainModel( 114 new StringModel("testdomain", log, ProfileEditor.TIME), 113 115 issuevaluesmodel, log); 114 116
Note:
See TracChangeset
for help on using the changeset viewer.