Skip to content

Commit

Permalink
Replaced Integer constructor with method valueOf
Browse files Browse the repository at this point in the history
  • Loading branch information
R. Kaleta committed Jun 17, 2019
1 parent 5dd9eed commit 5808670
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 27 deletions.
22 changes: 11 additions & 11 deletions test/fitaview/tree/TreeReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testReadFiniteTree()

Assert.assertNotNull(result);
Assert.assertEquals(expected, result.getFirst());
Assert.assertEquals(new Integer(3), result.getSecond());
Assert.assertEquals(Integer.valueOf(3), result.getSecond());
}

@Test
Expand All @@ -75,7 +75,7 @@ public void testReadWhenSingleRepeat()

repeat.setLeft(new StandardNode("6", 5));
repeat.setRight(
new StandardNode("7", 4, new RecNode(repeat, 9), new StandardNode("9", 8)));
new StandardNode("7", 4, new RecNode(repeat, 9), new StandardNode("9", 8)));
expected = new StandardNode("1", 1, new StandardNode("2", 3, new StandardNode("3", 7),
new StandardNode("4", 6)), repeat);
}
Expand All @@ -87,7 +87,7 @@ public void testReadWhenSingleRepeat()

Assert.assertNotNull(result);
Assert.assertEquals(expected, result.getFirst());
Assert.assertEquals(new Integer(4), result.getSecond());
Assert.assertEquals(Integer.valueOf(4), result.getSecond());
}

@Test
Expand All @@ -114,12 +114,12 @@ public void testReadWhenNestedRepeats()
RepeatNode repeat7 = new RepeatNode("7", 11);

repeat7.setLeft(
new StandardNode("8", 23, new RecNode(repeat7, 47), new RecNode(repeat7, 46)));
new StandardNode("8", 23, new RecNode(repeat7, 47), new RecNode(repeat7, 46)));
repeat7.setRight(new StandardNode("11", 22));

repeat5.setLeft(new StandardNode("6", 5, repeat7, new RecNode(repeat5, 10)));
repeat5.setRight(
new StandardNode("13", 4, new RecNode(repeat5, 9), new StandardNode("15", 8)));
new StandardNode("13", 4, new RecNode(repeat5, 9), new StandardNode("15", 8)));

expected = new StandardNode("1", 1, new StandardNode("2", 3, new StandardNode("3", 7),
new StandardNode("4", 6)),
Expand All @@ -133,12 +133,12 @@ public void testReadWhenNestedRepeats()

Assert.assertNotNull(result);
Assert.assertEquals(expected, result.getFirst());
Assert.assertEquals(new Integer(6), result.getSecond());
Assert.assertEquals(Integer.valueOf(6), result.getSecond());
}

@Test(expected = TreeParsingException.class)
public void testReadWhenRecOutOfScope()
throws SAXException
throws SAXException
{
try
{
Expand All @@ -163,7 +163,7 @@ public void testReadWhenRecOutOfScope()

@Test(expected = OneChildException.class)
public void testReadWhenOneChild()
throws SAXException
throws SAXException
{
try
{
Expand All @@ -188,12 +188,12 @@ public void testReadWhenOneChild()

@Test(expected = TreeDepthException.class)
public void testReadWhenTreeDepthIsViolated()
throws SAXException
throws SAXException
{
try
{
testObject = new TreeReader(
new File(DIRECTORY + "testReadWhenTreeDepthIsViolated.tree.xml"));
new File(DIRECTORY + "testReadWhenTreeDepthIsViolated.tree.xml"));
}
catch(Exception e)
{
Expand All @@ -214,7 +214,7 @@ public void testReadWhenTreeDepthIsViolated()

@Test(expected = TreeParsingException.class)
public void testReadWhenThreeChildren()
throws SAXException
throws SAXException
{
try
{
Expand Down
29 changes: 13 additions & 16 deletions test/fitaview/viewer/tree/MovingButtonsPanelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
@RunWith(MockitoJUnitRunner.class)
public class MovingButtonsPanelTest
{
@Mock
private TreeDrawingArea mockDrawingArea;
@Mock private TreeDrawingArea mockDrawingArea;

@Mock
private ActionEvent mockActionEvent;
@Mock private ActionEvent mockActionEvent;

@InjectMocks
private MovingButtonsPanel testObject;
@InjectMocks private MovingButtonsPanel testObject;

@Before
public void setUp()
Expand Down Expand Up @@ -54,8 +51,8 @@ public void testActionPerformedWhenCentre()
Pair<Integer, Integer> result = mockDrawingArea.getAxisPoint();

Mockito.verify(mockDrawingArea, Mockito.times(1)).centralize();
Assert.assertEquals(new Integer(0), result.getFirst());
Assert.assertEquals(new Integer(0), result.getSecond());
Assert.assertEquals(Integer.valueOf(0), result.getFirst());
Assert.assertEquals(Integer.valueOf(0), result.getSecond());
}

@Test
Expand All @@ -68,8 +65,8 @@ public void testActionPerformedWhenUp()
Pair<Integer, Integer> result = mockDrawingArea.getAxisPoint();

Mockito.verify(mockDrawingArea, Mockito.times(1)).moveArea(0, 1);
Assert.assertEquals(new Integer(mockDrawingArea.getStepUnit()), result.getFirst());
Assert.assertEquals(new Integer(0), result.getSecond());
Assert.assertEquals(Integer.valueOf(mockDrawingArea.getStepUnit()), result.getFirst());
Assert.assertEquals(Integer.valueOf(0), result.getSecond());
}

@Test
Expand All @@ -82,8 +79,8 @@ public void testActionPerformedWhenDown()
Pair<Integer, Integer> result = mockDrawingArea.getAxisPoint();

Mockito.verify(mockDrawingArea, Mockito.times(1)).moveArea(0, -1);
Assert.assertEquals(new Integer(-mockDrawingArea.getStepUnit()), result.getFirst());
Assert.assertEquals(new Integer(0), result.getSecond());
Assert.assertEquals(Integer.valueOf(-mockDrawingArea.getStepUnit()), result.getFirst());
Assert.assertEquals(Integer.valueOf(0), result.getSecond());
}

@Test
Expand All @@ -96,8 +93,8 @@ public void testActionPerformedWhenLeft()
Pair<Integer, Integer> result = mockDrawingArea.getAxisPoint();

Mockito.verify(mockDrawingArea, Mockito.times(1)).moveArea(1, 0);
Assert.assertEquals(new Integer(0), result.getFirst());
Assert.assertEquals(new Integer(mockDrawingArea.getStepUnit()), result.getSecond());
Assert.assertEquals(Integer.valueOf(0), result.getFirst());
Assert.assertEquals(Integer.valueOf(mockDrawingArea.getStepUnit()), result.getSecond());
}

@Test
Expand All @@ -110,7 +107,7 @@ public void testActionPerformedWhenRight()
Pair<Integer, Integer> result = mockDrawingArea.getAxisPoint();

Mockito.verify(mockDrawingArea, Mockito.times(1)).moveArea(-1, 0);
Assert.assertEquals(new Integer(0), result.getFirst());
Assert.assertEquals(new Integer(-mockDrawingArea.getStepUnit()), result.getSecond());
Assert.assertEquals(Integer.valueOf(0), result.getFirst());
Assert.assertEquals(Integer.valueOf(-mockDrawingArea.getStepUnit()), result.getSecond());
}
}

0 comments on commit 5808670

Please sign in to comment.