Bläddra i källkod

Merge pull request #465 from csmith/master

Random test tidying.
pull/466/head
Greg Holmes 8 år sedan
förälder
incheckning
a377b8ccd4

+ 8
- 8
calc/test/com/dmdirc/addons/calc/ParserTest.java Visa fil

142
 
142
 
143
         parser.parseHiddenOperator(tokens, 0);
143
         parser.parseHiddenOperator(tokens, 0);
144
         assertEquals(4, tokens.size());
144
         assertEquals(4, tokens.size());
145
-        assertTrue(tokens.get(0).getToken().getType() == TokenType.BRACKET_OPEN);
145
+        assertSame(TokenType.BRACKET_OPEN, tokens.get(0).getToken().getType());
146
 
146
 
147
         parser.parseHiddenOperator(tokens, 3);
147
         parser.parseHiddenOperator(tokens, 3);
148
         assertEquals(3, tokens.size());
148
         assertEquals(3, tokens.size());
149
-        assertTrue(tokens.get(2).getToken().getType() == TokenType.BRACKET_CLOSE);
149
+        assertSame(TokenType.BRACKET_CLOSE, tokens.get(2).getToken().getType());
150
     }
150
     }
151
 
151
 
152
     @Test
152
     @Test
161
 
161
 
162
         parser.parseUnaryOperator(tokens, 1);
162
         parser.parseUnaryOperator(tokens, 1);
163
         assertEquals(3, tokens.size());
163
         assertEquals(3, tokens.size());
164
-        assertTrue(tokens.get(0).getToken().getType() == TokenType.START);
165
-        assertTrue(tokens.get(1).getToken().getType() == TokenType.MOD_NEGATIVE);
166
-        assertTrue(tokens.get(2).getToken().getType() == TokenType.END);
164
+        assertSame(TokenType.START, tokens.get(0).getToken().getType());
165
+        assertSame(TokenType.MOD_NEGATIVE, tokens.get(1).getToken().getType());
166
+        assertSame(TokenType.END, tokens.get(2).getToken().getType());
167
 
167
 
168
         assertTrue(tokens.get(1).isProcessed());
168
         assertTrue(tokens.get(1).isProcessed());
169
         assertEquals(1, tokens.get(1).getChildren().size());
169
         assertEquals(1, tokens.get(1).getChildren().size());
184
         parser.parseBinaryOperator(tokens, 2);
184
         parser.parseBinaryOperator(tokens, 2);
185
 
185
 
186
         assertEquals(3, tokens.size());
186
         assertEquals(3, tokens.size());
187
-        assertTrue(tokens.get(0).getToken().getType() == TokenType.START);
188
-        assertTrue(tokens.get(1).getToken().getType() == TokenType.OP_MINUS);
189
-        assertTrue(tokens.get(2).getToken().getType() == TokenType.END);
187
+        assertSame(TokenType.START, tokens.get(0).getToken().getType());
188
+        assertSame(TokenType.OP_MINUS, tokens.get(1).getToken().getType());
189
+        assertSame(TokenType.END, tokens.get(2).getToken().getType());
190
 
190
 
191
         assertTrue(tokens.get(1).isProcessed());
191
         assertTrue(tokens.get(1).isProcessed());
192
         assertEquals(2, tokens.get(1).getChildren().size());
192
         assertEquals(2, tokens.get(1).getChildren().size());

+ 1
- 2
mediasource_vlc/test/com/dmdirc/addons/mediasource_vlc/VlcMediaSourcePluginTest.java Visa fil

38
 public class VlcMediaSourcePluginTest {
38
 public class VlcMediaSourcePluginTest {
39
 
39
 
40
     @Test
40
     @Test
41
-    public void testProcessInformation1() throws IOException, URISyntaxException,
42
-            UnsupportedEncodingException {
41
+    public void testProcessInformation1() throws Exception {
43
         final PluginInfo pluginInfo = mock(PluginInfo.class);
42
         final PluginInfo pluginInfo = mock(PluginInfo.class);
44
         final IdentityController identityController = mock(IdentityController.class);
43
         final IdentityController identityController = mock(IdentityController.class);
45
         final VlcManager plugin = new VlcManager(pluginInfo, identityController);
44
         final VlcManager plugin = new VlcManager(pluginInfo, identityController);

+ 10
- 10
ui_swing/test/com/dmdirc/addons/ui_swing/components/vetoable/VetoableListSelectionModelTest.java Visa fil

52
     @Test
52
     @Test
53
     public void testInitialState() {
53
     public void testInitialState() {
54
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
54
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
55
-        assertEquals(instance.getLeadSelectionIndex(), -1);
56
-        assertEquals(instance.getSelectionMode(), SINGLE_SELECTION);
55
+        assertEquals(-1, instance.getLeadSelectionIndex());
56
+        assertEquals(SINGLE_SELECTION, instance.getSelectionMode());
57
         assertFalse(instance.getValueIsAdjusting());
57
         assertFalse(instance.getValueIsAdjusting());
58
     }
58
     }
59
 
59
 
61
     public void testNonVetoed() {
61
     public void testNonVetoed() {
62
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
62
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
63
         instance.setLeadSelectionIndex(5);
63
         instance.setLeadSelectionIndex(5);
64
-        assertEquals(instance.getLeadSelectionIndex(), 5);
64
+        assertEquals(5, instance.getLeadSelectionIndex());
65
     }
65
     }
66
 
66
 
67
     @Test
67
     @Test
69
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
69
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
70
         instance.addVetoableSelectionListener(vetoListener);
70
         instance.addVetoableSelectionListener(vetoListener);
71
         instance.setLeadSelectionIndex(5);
71
         instance.setLeadSelectionIndex(5);
72
-        assertEquals(instance.getLeadSelectionIndex(), 5);
72
+        assertEquals(5, instance.getLeadSelectionIndex());
73
         verify(vetoListener).vetoableChange(any(PropertyChangeEvent.class));
73
         verify(vetoListener).vetoableChange(any(PropertyChangeEvent.class));
74
     }
74
     }
75
 
75
 
80
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
80
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
81
         instance.addVetoableSelectionListener(vetoListener);
81
         instance.addVetoableSelectionListener(vetoListener);
82
         instance.setLeadSelectionIndex(5);
82
         instance.setLeadSelectionIndex(5);
83
-        assertEquals(instance.getLeadSelectionIndex(), -1);
83
+        assertEquals(-1, instance.getLeadSelectionIndex());
84
     }
84
     }
85
 
85
 
86
     @Test
86
     @Test
88
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
88
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
89
         instance.addListSelectionListener(selectionListener);
89
         instance.addListSelectionListener(selectionListener);
90
         instance.setLeadSelectionIndex(5);
90
         instance.setLeadSelectionIndex(5);
91
-        assertEquals(instance.getLeadSelectionIndex(), 5);
91
+        assertEquals(5, instance.getLeadSelectionIndex());
92
         verify(selectionListener).valueChanged(any(ListSelectionEvent.class));
92
         verify(selectionListener).valueChanged(any(ListSelectionEvent.class));
93
     }
93
     }
94
 
94
 
98
         instance.addListSelectionListener(selectionListener);
98
         instance.addListSelectionListener(selectionListener);
99
         instance.addVetoableSelectionListener(vetoListener);
99
         instance.addVetoableSelectionListener(vetoListener);
100
         instance.setLeadSelectionIndex(5);
100
         instance.setLeadSelectionIndex(5);
101
-        assertEquals(instance.getLeadSelectionIndex(), 5);
101
+        assertEquals(5, instance.getLeadSelectionIndex());
102
         verify(vetoListener).vetoableChange(any(PropertyChangeEvent.class));
102
         verify(vetoListener).vetoableChange(any(PropertyChangeEvent.class));
103
         verify(selectionListener).valueChanged(any(ListSelectionEvent.class));
103
         verify(selectionListener).valueChanged(any(ListSelectionEvent.class));
104
     }
104
     }
111
         instance.addListSelectionListener(selectionListener);
111
         instance.addListSelectionListener(selectionListener);
112
         instance.addVetoableSelectionListener(vetoListener);
112
         instance.addVetoableSelectionListener(vetoListener);
113
         instance.setLeadSelectionIndex(5);
113
         instance.setLeadSelectionIndex(5);
114
-        assertEquals(instance.getLeadSelectionIndex(), -1);
114
+        assertEquals(-1, instance.getLeadSelectionIndex());
115
         verify(vetoListener).vetoableChange(any(PropertyChangeEvent.class));
115
         verify(vetoListener).vetoableChange(any(PropertyChangeEvent.class));
116
         verify(selectionListener, never()).valueChanged(any(ListSelectionEvent.class));
116
         verify(selectionListener, never()).valueChanged(any(ListSelectionEvent.class));
117
     }
117
     }
120
     public void testClearSelection() {
120
     public void testClearSelection() {
121
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
121
         final VetoableListSelectionModel instance = new VetoableListSelectionModel();
122
         instance.setLeadSelectionIndex(5);
122
         instance.setLeadSelectionIndex(5);
123
-        assertEquals(instance.getLeadSelectionIndex(), 5);
123
+        assertEquals(5, instance.getLeadSelectionIndex());
124
         instance.clearSelection();
124
         instance.clearSelection();
125
-        assertEquals(instance.getLeadSelectionIndex(), -1);
125
+        assertEquals(-1, instance.getLeadSelectionIndex());
126
     }
126
     }
127
 
127
 
128
     @Test
128
     @Test

Laddar…
Avbryt
Spara