Skip to content

Commit

Permalink
Random test tidying.
Browse files Browse the repository at this point in the history
  • Loading branch information
csmith committed Feb 25, 2016
1 parent 49c2859 commit b5f291a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
16 changes: 8 additions & 8 deletions calc/test/com/dmdirc/addons/calc/ParserTest.java
Expand Up @@ -142,11 +142,11 @@ public void testParseHidden() {

parser.parseHiddenOperator(tokens, 0);
assertEquals(4, tokens.size());
assertTrue(tokens.get(0).getToken().getType() == TokenType.BRACKET_OPEN);
assertSame(TokenType.BRACKET_OPEN, tokens.get(0).getToken().getType());

parser.parseHiddenOperator(tokens, 3);
assertEquals(3, tokens.size());
assertTrue(tokens.get(2).getToken().getType() == TokenType.BRACKET_CLOSE);
assertSame(TokenType.BRACKET_CLOSE, tokens.get(2).getToken().getType());
}

@Test
Expand All @@ -161,9 +161,9 @@ public void testParseUnaryOps() {

parser.parseUnaryOperator(tokens, 1);
assertEquals(3, tokens.size());
assertTrue(tokens.get(0).getToken().getType() == TokenType.START);
assertTrue(tokens.get(1).getToken().getType() == TokenType.MOD_NEGATIVE);
assertTrue(tokens.get(2).getToken().getType() == TokenType.END);
assertSame(TokenType.START, tokens.get(0).getToken().getType());
assertSame(TokenType.MOD_NEGATIVE, tokens.get(1).getToken().getType());
assertSame(TokenType.END, tokens.get(2).getToken().getType());

assertTrue(tokens.get(1).isProcessed());
assertEquals(1, tokens.get(1).getChildren().size());
Expand All @@ -184,9 +184,9 @@ public void testParseBinaryOps() {
parser.parseBinaryOperator(tokens, 2);

assertEquals(3, tokens.size());
assertTrue(tokens.get(0).getToken().getType() == TokenType.START);
assertTrue(tokens.get(1).getToken().getType() == TokenType.OP_MINUS);
assertTrue(tokens.get(2).getToken().getType() == TokenType.END);
assertSame(TokenType.START, tokens.get(0).getToken().getType());
assertSame(TokenType.OP_MINUS, tokens.get(1).getToken().getType());
assertSame(TokenType.END, tokens.get(2).getToken().getType());

assertTrue(tokens.get(1).isProcessed());
assertEquals(2, tokens.get(1).getChildren().size());
Expand Down
Expand Up @@ -38,8 +38,7 @@
public class VlcMediaSourcePluginTest {

@Test
public void testProcessInformation1() throws IOException, URISyntaxException,
UnsupportedEncodingException {
public void testProcessInformation1() throws Exception {
final PluginInfo pluginInfo = mock(PluginInfo.class);
final IdentityController identityController = mock(IdentityController.class);
final VlcManager plugin = new VlcManager(pluginInfo, identityController);
Expand Down
Expand Up @@ -52,24 +52,24 @@ public class VetoableListSelectionModelTest {
@Test
public void testInitialState() {
final VetoableListSelectionModel instance = new VetoableListSelectionModel();
assertEquals(instance.getLeadSelectionIndex(), -1);
assertEquals(instance.getSelectionMode(), SINGLE_SELECTION);
assertEquals(-1, instance.getLeadSelectionIndex());
assertEquals(SINGLE_SELECTION, instance.getSelectionMode());
assertFalse(instance.getValueIsAdjusting());
}

@Test
public void testNonVetoed() {
final VetoableListSelectionModel instance = new VetoableListSelectionModel();
instance.setLeadSelectionIndex(5);
assertEquals(instance.getLeadSelectionIndex(), 5);
assertEquals(5, instance.getLeadSelectionIndex());
}

@Test
public void testVetoedCalled() throws PropertyVetoException {
final VetoableListSelectionModel instance = new VetoableListSelectionModel();
instance.addVetoableSelectionListener(vetoListener);
instance.setLeadSelectionIndex(5);
assertEquals(instance.getLeadSelectionIndex(), 5);
assertEquals(5, instance.getLeadSelectionIndex());
verify(vetoListener).vetoableChange(any(PropertyChangeEvent.class));
}

Expand All @@ -80,15 +80,15 @@ public void testVetoedCalledAndVetoed() throws PropertyVetoException {
final VetoableListSelectionModel instance = new VetoableListSelectionModel();
instance.addVetoableSelectionListener(vetoListener);
instance.setLeadSelectionIndex(5);
assertEquals(instance.getLeadSelectionIndex(), -1);
assertEquals(-1, instance.getLeadSelectionIndex());
}

@Test
public void testListenerCalledWithoutVetoListener() {
final VetoableListSelectionModel instance = new VetoableListSelectionModel();
instance.addListSelectionListener(selectionListener);
instance.setLeadSelectionIndex(5);
assertEquals(instance.getLeadSelectionIndex(), 5);
assertEquals(5, instance.getLeadSelectionIndex());
verify(selectionListener).valueChanged(any(ListSelectionEvent.class));
}

Expand All @@ -98,7 +98,7 @@ public void testListenerCalledWithVetoListenerNoVeto() throws PropertyVetoExcept
instance.addListSelectionListener(selectionListener);
instance.addVetoableSelectionListener(vetoListener);
instance.setLeadSelectionIndex(5);
assertEquals(instance.getLeadSelectionIndex(), 5);
assertEquals(5, instance.getLeadSelectionIndex());
verify(vetoListener).vetoableChange(any(PropertyChangeEvent.class));
verify(selectionListener).valueChanged(any(ListSelectionEvent.class));
}
Expand All @@ -111,7 +111,7 @@ public void testListenerCalledWithVetoListenerWithVeto() throws PropertyVetoExce
instance.addListSelectionListener(selectionListener);
instance.addVetoableSelectionListener(vetoListener);
instance.setLeadSelectionIndex(5);
assertEquals(instance.getLeadSelectionIndex(), -1);
assertEquals(-1, instance.getLeadSelectionIndex());
verify(vetoListener).vetoableChange(any(PropertyChangeEvent.class));
verify(selectionListener, never()).valueChanged(any(ListSelectionEvent.class));
}
Expand All @@ -120,9 +120,9 @@ public void testListenerCalledWithVetoListenerWithVeto() throws PropertyVetoExce
public void testClearSelection() {
final VetoableListSelectionModel instance = new VetoableListSelectionModel();
instance.setLeadSelectionIndex(5);
assertEquals(instance.getLeadSelectionIndex(), 5);
assertEquals(5, instance.getLeadSelectionIndex());
instance.clearSelection();
assertEquals(instance.getLeadSelectionIndex(), -1);
assertEquals(-1, instance.getLeadSelectionIndex());
}

@Test
Expand Down

0 comments on commit b5f291a

Please sign in to comment.