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>
This commit is contained in:
David Pursehouse 2018-09-04 14:23:14 +09:00
parent 559c68cb01
commit 2173f44158
1 changed files with 3 additions and 3 deletions

View File

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