Browse Source

UploadPackTest: Avoid unnecessarily boxing int into Integer

The statement:

  assertThat(recvStream.available(), is(0));

results in a warning from Eclipse:

  The expression of type int is boxed into Integer

because recvStream.available() returns int, but the hamcrest is()
method takes an Integer.

Replace it with the equivalent JUnit assertion.

Also remove the suppression of another similar warning and fix that
in the same way.

Change-Id: I6f18b304a540bcd0a10aec7d3abc7dc6f047fe80
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.2
David Pursehouse 6 years ago
parent
commit
2173f44158
  1. 6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java

6
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java

@ -5,6 +5,7 @@ import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.theInstance; import static org.hamcrest.Matchers.theInstance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@ -577,12 +578,11 @@ public class UploadPackTest {
} }
@Test @Test
@SuppressWarnings("boxing")
public void testV2EmptyRequest() throws Exception { public void testV2EmptyRequest() throws Exception {
ByteArrayInputStream recvStream = uploadPackV2(PacketLineIn.END); ByteArrayInputStream recvStream = uploadPackV2(PacketLineIn.END);
// Verify that there is nothing more after the capability // Verify that there is nothing more after the capability
// advertisement. // advertisement.
assertThat(recvStream.available(), is(0)); assertEquals(0, recvStream.available());
} }
@Test @Test
@ -735,7 +735,7 @@ public class UploadPackTest {
pp.parse(NullProgressMonitor.INSTANCE); pp.parse(NullProgressMonitor.INSTANCE);
// Ensure that there is nothing left in the stream. // Ensure that there is nothing left in the stream.
assertThat(recvStream.read(), is(-1)); assertEquals(-1, recvStream.read());
return pp.getReceivedPackStatistics(); return pp.getReceivedPackStatistics();
} }

Loading…
Cancel
Save