diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2012-09-22 01:15:39 +0200 |
---|---|---|
committer | Robin Rosenberg <robin.rosenberg@dewire.com> | 2012-09-22 01:21:00 +0200 |
commit | c3f1fac03fdf3ed5165adfd22aa14a21e5876892 (patch) | |
tree | 6403e5f3175dbcdccfe0719a838527efd7d580fb /org.eclipse.jgit.test | |
parent | 46d42404d3913e626f86a4520032a689d207b4c8 (diff) | |
download | jgit-c3f1fac03fdf3ed5165adfd22aa14a21e5876892.tar.gz jgit-c3f1fac03fdf3ed5165adfd22aa14a21e5876892.zip |
Suppress boxing warnings where we know they are ok
Invoke the wrapper types' valueOf via static imports.
For booleans used in asserts, add a new assert in
the JUnit utility package since out current version of JUnit
does not have the assert(boolean, boolean) method.
Change-Id: I9099bd8efbc8c133479344d51ce7dabed8958a2b
Diffstat (limited to 'org.eclipse.jgit.test')
12 files changed, 37 insertions, 21 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java index e14190b53d..36ebd6f22a 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java @@ -43,6 +43,7 @@ package org.eclipse.jgit.dircache; +import static org.eclipse.jgit.junit.Assert.assertEquals; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java index 3553fcf43c..13c8cbef59 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java @@ -44,7 +44,7 @@ package org.eclipse.jgit.fnmatch; -import static org.junit.Assert.assertEquals; +import static org.eclipse.jgit.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java index 51d4c0f940..fcc8d2b0ec 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java @@ -42,6 +42,7 @@ */ package org.eclipse.jgit.ignore; +import static org.eclipse.jgit.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java index 250a7f0b99..380defaa08 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java @@ -44,6 +44,8 @@ package org.eclipse.jgit.lib; +import static java.lang.Integer.valueOf; +import static java.lang.Long.valueOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -69,7 +71,9 @@ public class ObjectCheckerTest { fail("Did not throw CorruptObjectException"); } catch (CorruptObjectException e) { final String m = e.getMessage(); - assertEquals(MessageFormat.format(JGitText.get().corruptObjectInvalidType2, Constants.OBJ_BAD), m); + assertEquals(MessageFormat.format( + JGitText.get().corruptObjectInvalidType2, + valueOf(Constants.OBJ_BAD)), m); } } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java index c25ee4c04a..13f17550d1 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java @@ -42,6 +42,7 @@ */ package org.eclipse.jgit.lib; +import static java.lang.Long.valueOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -66,12 +67,12 @@ public class RacyGitTests extends RepositoryTestCase { if (i == 5) fsTick(lastFile); } - modTimes.add(fsTick(lastFile)); + modTimes.add(valueOf(fsTick(lastFile))); for (int i = 0; i < 10; i++) { lastFile = new File(db.getWorkTree(), "1." + i); FileUtils.createNewFile(lastFile); } - modTimes.add(fsTick(lastFile)); + modTimes.add(valueOf(fsTick(lastFile))); for (int i = 0; i < 10; i++) { lastFile = new File(db.getWorkTree(), "2." + i); FileUtils.createNewFile(lastFile); @@ -122,7 +123,7 @@ public class RacyGitTests extends RepositoryTestCase { // wait to ensure that modtimes of the file doesn't match last index // file modtime - modTimes.add(fsTick(db.getIndexFile())); + modTimes.add(valueOf(fsTick(db.getIndexFile()))); // create two files addToWorkDir("a", "a"); @@ -130,7 +131,7 @@ public class RacyGitTests extends RepositoryTestCase { // wait to ensure that file-modTimes and therefore index entry modTime // doesn't match the modtime of index-file after next persistance - modTimes.add(fsTick(lastFile)); + modTimes.add(valueOf(fsTick(lastFile))); // now add both files to the index. No racy git expected resetIndex(new FileTreeIteratorWithTimeControl(db, modTimes)); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java index 48140161d4..c1cd596d0b 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java @@ -45,6 +45,7 @@ package org.eclipse.jgit.lib; +import static org.eclipse.jgit.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java index 36d6e3999e..08d675bc04 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java @@ -43,7 +43,7 @@ package org.eclipse.jgit.lib; -import static org.junit.Assert.assertEquals; +import static org.eclipse.jgit.junit.Assert.assertEquals; import org.junit.Test; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java index 6c6d9f5953..962e81856b 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java @@ -43,6 +43,8 @@ package org.eclipse.jgit.patch; +import static java.lang.Integer.valueOf; +import static java.lang.Long.valueOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; @@ -65,9 +67,9 @@ public class PatchCcErrorTest { { final FormatError e = p.getErrors().get(0); assertSame(FormatError.Severity.ERROR, e.getSeverity()); - assertEquals( - MessageFormat.format(JGitText.get().truncatedHunkLinesMissingForAncestor, 1, 1), - e.getMessage()); + assertEquals(MessageFormat.format( + JGitText.get().truncatedHunkLinesMissingForAncestor, + valueOf(1), valueOf(1)), e.getMessage()); assertEquals(346, e.getOffset()); assertTrue(e.getLineText().startsWith( "@@@ -55,12 -163,13 +163,15 @@@ public ")); @@ -75,9 +77,9 @@ public class PatchCcErrorTest { { final FormatError e = p.getErrors().get(1); assertSame(FormatError.Severity.ERROR, e.getSeverity()); - assertEquals( - MessageFormat.format(JGitText.get().truncatedHunkLinesMissingForAncestor, 2, 2), - e.getMessage()); + assertEquals(MessageFormat.format( + JGitText.get().truncatedHunkLinesMissingForAncestor, + valueOf(2), valueOf(2)), e.getMessage()); assertEquals(346, e.getOffset()); assertTrue(e.getLineText().startsWith( "@@@ -55,12 -163,13 +163,15 @@@ public ")); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java index 04fc68a6f1..8b6c003888 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java @@ -42,6 +42,7 @@ */ package org.eclipse.jgit.storage.file; +import static java.lang.Integer.valueOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertSame; @@ -134,9 +135,9 @@ public class GCTest extends LocalDiskRepositoryTestCase { syncPoint.await(); try { gc.packRefs(); - return 0; + return valueOf(0); } catch (IOException e) { - return 1; + return valueOf(1); } } }; @@ -144,7 +145,7 @@ public class GCTest extends LocalDiskRepositoryTestCase { try { Future<Integer> p1 = pool.submit(packRefs); Future<Integer> p2 = pool.submit(packRefs); - assertTrue(p1.get() + p2.get() == 1); + assertEquals(1, p1.get().intValue() + p2.get().intValue()); } finally { pool.shutdown(); pool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS); @@ -257,7 +258,7 @@ public class GCTest extends LocalDiskRepositoryTestCase { try { gc.setProgressMonitor(this); gc.repack(); - return 0; + return valueOf(0); } catch (IOException e) { // leave the syncPoint in broken state so any awaiting // threads and any threads that call await in the future get @@ -268,7 +269,7 @@ public class GCTest extends LocalDiskRepositoryTestCase { } catch (InterruptedException ignored) { // } - return 1; + return valueOf(1); } } } @@ -282,7 +283,7 @@ public class GCTest extends LocalDiskRepositoryTestCase { DoRepack repack2 = new DoRepack(); Future<Integer> result1 = pool.submit(repack1); Future<Integer> result2 = pool.submit(repack2); - assertTrue(result1.get() + result2.get() == 0); + assertEquals(0, result1.get().intValue() + result2.get().intValue()); } finally { pool.shutdown(); pool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java index e92bca6d5d..8bc454a58c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java @@ -45,6 +45,7 @@ package org.eclipse.jgit.storage.file; +import static org.eclipse.jgit.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java index b107b053ea..2924297de7 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java @@ -43,6 +43,8 @@ package org.eclipse.jgit.transport; +import static java.lang.Integer.valueOf; +import static java.lang.Long.valueOf; import static org.eclipse.jgit.transport.SideBandOutputStream.CH_DATA; import static org.eclipse.jgit.transport.SideBandOutputStream.CH_ERROR; import static org.eclipse.jgit.transport.SideBandOutputStream.CH_PROGRESS; @@ -236,7 +238,9 @@ public class SideBandOutputStreamTest { new SideBandOutputStream(CH_DATA, Integer.MAX_VALUE, rawOut); fail("Accepted " + Integer.MAX_VALUE + " for buffer size"); } catch (IllegalArgumentException e) { - assertEquals(MessageFormat.format(JGitText.get().packetSizeMustBeAtMost, Integer.MAX_VALUE, 65520), e.getMessage()); + assertEquals(MessageFormat.format( + JGitText.get().packetSizeMustBeAtMost, + valueOf(Integer.MAX_VALUE), valueOf(65520)), e.getMessage()); } } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/NotTreeFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/NotTreeFilterTest.java index b1b943c2dc..818941915a 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/NotTreeFilterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/NotTreeFilterTest.java @@ -43,7 +43,7 @@ package org.eclipse.jgit.treewalk.filter; -import static org.junit.Assert.assertEquals; +import static org.eclipse.jgit.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotSame; |