]> source.dussan.org Git - jgit.git/commitdiff
Suppress boxing warnings where we know they are ok 71/7771/5
authorRobin Rosenberg <robin.rosenberg@dewire.com>
Fri, 21 Sep 2012 23:15:39 +0000 (01:15 +0200)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Fri, 21 Sep 2012 23:21:00 +0000 (01:21 +0200)
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

26 files changed:
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CQ.java
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/Assert.java [new file with mode: 0644]
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/NotTreeFilterTest.java

index bee2bfc1918a1d49e9a0027e0747eede268d2dcb..2d466e2bc81462b4b491b063bbb4416e07c232cb 100644 (file)
@@ -53,6 +53,8 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 
+import static java.lang.Integer.valueOf;
+
 import org.eclipse.jgit.http.server.HttpServerText;
 
 /**
@@ -72,7 +74,8 @@ public class RegexGroupFilter implements Filter {
         */
        public RegexGroupFilter(final int groupIdx) {
                if (groupIdx < 1)
-                       throw new IllegalArgumentException(MessageFormat.format(HttpServerText.get().invalidIndex, groupIdx));
+                       throw new IllegalArgumentException(MessageFormat.format(
+                                       HttpServerText.get().invalidIndex, valueOf(groupIdx)));
                this.groupIdx = groupIdx - 1;
        }
 
@@ -91,7 +94,9 @@ public class RegexGroupFilter implements Filter {
                if (groupIdx < g.length)
                        chain.doFilter(g[groupIdx], rsp);
                else
-                       throw new ServletException(MessageFormat.format(HttpServerText.get().invalidRegexGroup, (groupIdx + 1)));
+                       throw new ServletException(MessageFormat.format(
+                                       HttpServerText.get().invalidRegexGroup,
+                                       valueOf(groupIdx + 1)));
        }
 
        private static WrappedRequest[] groupsFor(final ServletRequest r) {
index 13781f48ad8086a6b8a34333d859c4f28bf9f25a..73f062a4a3d9abc6e4b10225e95d100344640894 100644 (file)
@@ -43,6 +43,8 @@
 
 package org.eclipse.jgit.iplog;
 
+import static java.lang.Long.valueOf;
+
 import java.text.MessageFormat;
 import java.util.Comparator;
 
@@ -157,6 +159,6 @@ class CQ {
 
        @Override
        public String toString() {
-               return MessageFormat.format(IpLogText.get().CQString, getID());
+               return MessageFormat.format(IpLogText.get().CQString, valueOf(getID()));
        }
 }
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/Assert.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/Assert.java
new file mode 100644 (file)
index 0000000..40a05b4
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012, Robin Rosenberg
+ * and other copyright owners as documented in the project's IP log.
+ *
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Distribution License v1.0 which
+ * accompanies this distribution, is reproduced below, and is
+ * available at http://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ *
+ * - Neither the name of the Eclipse Foundation, Inc. nor the
+ *   names of its contributors may be used to endorse or promote
+ *   products derived from this software without specific prior
+ *   written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.eclipse.jgit.junit;
+
+import static java.lang.Boolean.valueOf;
+
+public class Assert {
+
+       public static void assertEquals(boolean expect, boolean actual) {
+               org.junit.Assert.assertEquals(valueOf(expect), valueOf(actual));
+       }
+
+       public static void assertEquals(String message, boolean expect,
+                       boolean actual) {
+               org.junit.Assert
+                               .assertEquals(message, valueOf(expect), valueOf(actual));
+       }
+}
index 4633187d77d530a997d19ec4203996937f41a0c9..ed0236b811c5bf61303e1fe51768fb1f36c7d077 100644 (file)
@@ -47,6 +47,8 @@
 
 package org.eclipse.jgit.pgm;
 
+import static java.lang.Character.valueOf;
+
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.text.MessageFormat;
@@ -82,7 +84,8 @@ abstract class AbstractFetchCommand extends TextBuiltin {
                                        shownURI = true;
                                }
 
-                               outw.format(" %c %-17s %-10s -> %s", type, longType, src, dst);
+                               outw.format(" %c %-17s %-10s -> %s", valueOf(type), longType,
+                                               src, dst);
                                outw.println();
                        }
                } finally {
index f137b10acaacee1ae41cc2a84bbfbc0c5a4613ea..8485ab5f3829678ae715f69adea33670614a88e8 100644 (file)
@@ -44,6 +44,8 @@
 
 package org.eclipse.jgit.pgm;
 
+import static java.lang.Integer.valueOf;
+
 import java.io.EOFException;
 import java.io.File;
 import java.io.FileInputStream;
@@ -91,7 +93,9 @@ class AmazonS3Client extends TextBuiltin {
                                while (len > 0) {
                                        final int n = in.read(tmp);
                                        if (n < 0)
-                                               throw new EOFException(MessageFormat.format(CLIText.get().expectedNumberOfbytes, len));
+                                               throw new EOFException(MessageFormat.format(
+                                                               CLIText.get().expectedNumberOfbytes,
+                                                               valueOf(len)));
                                        outs.write(tmp, 0, n);
                                        len -= n;
                                }
index a67c35d9337d1701e3ebfa6cc716fc83273728e9..801e3972faf1b19618a2c621b5f3fd273c3a78fc 100644 (file)
@@ -46,6 +46,8 @@
 
 package org.eclipse.jgit.pgm;
 
+import static java.lang.Integer.valueOf;
+import static java.lang.Long.valueOf;
 import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH;
 
 import java.io.File;
@@ -201,23 +203,23 @@ class Blame extends TextBuiltin {
                                maxSourceLine = Math.max(maxSourceLine, blame.getSourceLine(line));
                        }
 
-                       String pathFmt = MessageFormat.format(" %{0}s", pathWidth);
+                       String pathFmt = MessageFormat.format(" %{0}s", valueOf(pathWidth));
                        String numFmt = MessageFormat.format(" %{0}d",
-                                       1 + (int) Math.log10(maxSourceLine + 1));
+                                       valueOf(1 + (int) Math.log10(maxSourceLine + 1)));
                        String lineFmt = MessageFormat.format(" %{0}d) ",
-                                       1 + (int) Math.log10(end + 1));
+                                       valueOf(1 + (int) Math.log10(end + 1)));
                        String authorFmt = MessageFormat.format(" (%-{0}s %{1}s",
-                                       authorWidth, dateWidth);
+                                       valueOf(authorWidth), valueOf(dateWidth));
 
                        for (int line = begin; line < end; line++) {
                                outw.print(abbreviate(blame.getSourceCommit(line)));
                                if (showSourcePath)
                                        outw.format(pathFmt, path(line));
                                if (showSourceLine)
-                                       outw.format(numFmt, blame.getSourceLine(line) + 1);
+                                       outw.format(numFmt, valueOf(blame.getSourceLine(line) + 1));
                                if (!noAuthor)
                                        outw.format(authorFmt, author(line), date(line));
-                               outw.format(lineFmt, line + 1);
+                               outw.format(lineFmt, valueOf(line + 1));
                                outw.flush();
                                blame.getResultContents().writeLine(outs, line);
                                outs.flush();
@@ -314,7 +316,8 @@ class Blame extends TextBuiltin {
                dateFmt.setTimeZone(author.getTimeZone());
                if (!showRawTimestamp)
                        return dateFmt.format(author.getWhen());
-               return String.format("%d %s", author.getWhen().getTime() / 1000L,
+               return String.format("%d %s",
+                               valueOf(author.getWhen().getTime() / 1000L),
                                dateFmt.format(author.getWhen()));
        }
 
index 56564c71c2263475584499695a54e91bc7181869..0085888231934d090f068d6029ad419b3e066ba8 100644 (file)
@@ -45,6 +45,7 @@
 
 package org.eclipse.jgit.pgm;
 
+import static java.lang.Integer.valueOf;
 import static org.eclipse.jgit.lib.Constants.HEAD;
 import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH;
 
@@ -229,12 +230,12 @@ class Diff extends TextBuiltin {
                                out.println("M\t" + ent.getNewPath());
                                break;
                        case COPY:
-                               out.format("C%1$03d\t%2$s\t%3$s", ent.getScore(), //
+                               out.format("C%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), //
                                                ent.getOldPath(), ent.getNewPath());
                                out.println();
                                break;
                        case RENAME:
-                               out.format("R%1$03d\t%2$s\t%3$s", ent.getScore(), //
+                               out.format("R%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), //
                                                ent.getOldPath(), ent.getNewPath());
                                out.println();
                                break;
index f4665172502a462fa55ced76bc47f40f23a5ae15..2c10cf98f5cc2ad8a754c826c6077dae020c0c33 100644 (file)
@@ -44,6 +44,8 @@
 
 package org.eclipse.jgit.pgm;
 
+import static java.lang.Character.valueOf;
+
 import java.io.IOException;
 import java.text.MessageFormat;
 import java.util.ArrayList;
@@ -250,7 +252,7 @@ class Push extends TextBuiltin {
        private void printUpdateLine(final char flag, final String summary,
                        final String srcRef, final String destRef, final String message)
                        throws IOException {
-               outw.format(" %c %-17s", flag, summary);
+               out.format(" %c %-17s", valueOf(flag), summary);
 
                if (srcRef != null)
                        outw.format(" %s ->", abbreviateRef(srcRef, true));
index ef297322dfeaef7ded8ed5d493aa555640ec5e69..2a67b389ed4d86c107654e0c00a0ffa84806b448 100644 (file)
@@ -43,6 +43,9 @@
 
 package org.eclipse.jgit.pgm.debug;
 
+import static java.lang.Integer.valueOf;
+import static java.lang.Long.valueOf;
+
 import java.io.File;
 import java.lang.management.ManagementFactory;
 import java.lang.management.ThreadMXBean;
@@ -248,8 +251,10 @@ class DiffAlgorithms extends TextBuiltin {
                        outw.println(name + ": start at " + startId.name());
                }
 
-               outw.format("  %12d files,     %8d commits\n", files, commits);
-               outw.format("  N=%10d min lines, %8d max lines\n", minN, maxN);
+               outw.format("  %12d files,     %8d commits\n", valueOf(files),
+                               valueOf(commits));
+               outw.format("  N=%10d min lines, %8d max lines\n", valueOf(minN),
+                               valueOf(maxN));
 
                outw.format("%-25s %12s ( %12s  %12s )\n", //
                                "Algorithm", "Time(ns)", "Time(ns) on", "Time(ns) on");
@@ -261,9 +266,9 @@ class DiffAlgorithms extends TextBuiltin {
                for (Test test : all) {
                        outw.format("%-25s %12d ( %12d  %12d )", //
                                        test.algorithm.name, //
-                                       test.runningTimeNanos, //
-                                       test.minN.runningTimeNanos, //
-                                       test.maxN.runningTimeNanos);
+                                       valueOf(test.runningTimeNanos), //
+                                       valueOf(test.minN.runningTimeNanos), //
+                                       valueOf(test.maxN.runningTimeNanos));
                        outw.println();
                }
                outw.println();
index 3961a7c1560e05b9d628201555b7668e54694c77..4769f1159d51b07f0aac068e8286d39a22adca25 100644 (file)
@@ -44,6 +44,8 @@
 
 package org.eclipse.jgit.pgm.debug;
 
+import static java.lang.Integer.valueOf;
+
 import java.io.IOException;
 import java.text.MessageFormat;
 
@@ -61,8 +63,9 @@ class MakeCacheTree extends TextBuiltin {
        }
 
        private void show(final DirCacheTree tree) throws IOException {
-               outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo
-                               , tree.getPathString(), tree.getEntrySpan(), tree.getChildCount()));
+               outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
+                               tree.getPathString(), valueOf(tree.getEntrySpan()),
+                               valueOf(tree.getChildCount())));
 
                for (int i = 0; i < tree.getChildCount(); i++)
                        show(tree.getChild(i));
index 83dacce6b5bddd84fc77d653d13d9d7e698fa6ad..9f6bcda2a1af493047e9faab8cc323f43dd2b792 100644 (file)
@@ -44,6 +44,8 @@
 
 package org.eclipse.jgit.pgm.debug;
 
+import static java.lang.Long.valueOf;
+
 import java.text.MessageFormat;
 
 import org.eclipse.jgit.pgm.CLIText;
@@ -58,6 +60,7 @@ class ReadDirCache extends TextBuiltin {
                        db.readDirCache();
                final long end = System.currentTimeMillis();
                outw.print(" ");
-               outw.println(MessageFormat.format(CLIText.get().averageMSPerRead, (end - start) / cnt));
+               outw.println(MessageFormat.format(CLIText.get().averageMSPerRead,
+                               valueOf((end - start) / cnt)));
        }
 }
index 7b4b36aa423090bf25f804711e0eb56ed7e65db8..9fa8c6995457644abd3da8764801f55cdb8a245b 100644 (file)
@@ -44,6 +44,8 @@
 
 package org.eclipse.jgit.pgm.debug;
 
+import static java.lang.Integer.valueOf;
+
 import java.io.IOException;
 import java.text.MessageFormat;
 
@@ -63,8 +65,9 @@ class ShowCacheTree extends TextBuiltin {
        }
 
        private void show(final DirCacheTree tree) throws IOException {
-               outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo
-                               , tree.getPathString(), tree.getEntrySpan(), tree.getChildCount()));
+               outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
+                               tree.getPathString(), valueOf(tree.getEntrySpan()),
+                               valueOf(tree.getChildCount())));
 
                for (int i = 0; i < tree.getChildCount(); i++)
                        show(tree.getChild(i));
index a710103e9d8aaf31e29c3574905340c5f5d1eedc..040b2e50e7b0929d6964a7fa8fa972110725ae84 100644 (file)
@@ -46,6 +46,8 @@
 
 package org.eclipse.jgit.pgm.debug;
 
+import static java.lang.Integer.valueOf;
+
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
@@ -69,7 +71,7 @@ class ShowDirCache extends TextBuiltin {
                        final int stage = ent.getStage();
 
                        outw.print(mode);
-                       outw.format(" %6d", len);
+                       outw.format(" %6d", valueOf(len));
                        outw.print(' ');
                        outw.print(fmt.format(mtime));
                        outw.print(' ');
index ab80037da3e0f0290b3f73f6b2914d69af8bb871..df7058f1381680de4e1dedb1ee9db9b5012738aa 100644 (file)
@@ -43,6 +43,9 @@
 
 package org.eclipse.jgit.pgm.debug;
 
+import static java.lang.Integer.valueOf;
+import static java.lang.Long.valueOf;
+
 import java.io.File;
 import java.lang.reflect.Field;
 import java.security.MessageDigest;
@@ -347,8 +350,8 @@ class TextHashFunctions extends TextBuiltin {
                        outw.println(name + ":");
                }
                outw.format("  %6d files; %5d avg. unique lines/file\n", //
-                               fileCnt, //
-                               lineCnt / fileCnt);
+                               valueOf(fileCnt), //
+                               valueOf(lineCnt / fileCnt));
                outw.format("%-20s %-15s %9s\n", "Hash", "Fold", "Max Len");
                outw.println("-----------------------------------------------");
                String lastHashName = null;
@@ -359,7 +362,7 @@ class TextHashFunctions extends TextBuiltin {
                        outw.format("%-20s %-15s %9d\n", //
                                        hashName, //
                                        fun.fold.name, //
-                                       fun.maxChainLength);
+                                       valueOf(fun.maxChainLength));
                        lastHashName = fun.hash.name;
                }
                outw.println();
index e14190b53d7743968e41f07f221bfac1592b0f8c..36ebd6f22a82c01aa77c7add2ca1227670936148 100644 (file)
@@ -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;
index 3553fcf43cd3c5e5c337cf4cbe31a86f068d1cc5..13c8cbef59d3bde8099f6586d3c8cc426a1dd96d 100644 (file)
@@ -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;
index 51d4c0f940a79ab35d7ea637c1fd4612bab80bc4..fcc8d2b0ec03325ae839dc5751523b288d38bf81 100644 (file)
@@ -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;
index 250a7f0b992152a27b307f1b0f8b9d2366e31b15..380defaa08ca6d3f8d87c9f4b355f9f92cac1235 100644 (file)
@@ -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);
                }
        }
 
index c25ee4c04a9ea677dbcf4f5e27568cbad6a06d87..13f17550d13eafba93a80a6156a38a00a497cc0c 100644 (file)
@@ -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));
index 48140161d42cb2b947929d2d07ad3ab15c46d5c6..c1cd596d0b2893ecfbb7a1856696b6f60f48b390 100644 (file)
@@ -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;
index 36d6e3999e57485d26eef7b75b6e1bf0627a4050..08d675bc047f90c5ae93a80e5825b5f4431b2749 100644 (file)
@@ -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;
 
index 6c6d9f595310a85904fe2d1259a0c762b589c84d..962e81856bef55a54630dadfbe049eeafcd1f29a 100644 (file)
@@ -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 "));
index 04fc68a6f10cb84162ba70ba2220f82ba62e77e9..8b6c00388842057645efb03114cf7e83f8d0bcde 100644 (file)
@@ -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);
index e92bca6d5df826638874166a56840dff49f759d2..8bc454a58cd5b95753cc6a543a90643bc0c0832b 100644 (file)
@@ -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;
index b107b053eaf7a6a3b0860806da3b6223f69ed199..2924297de76a397c0d97dbfc0a3279e08bdfa4b0 100644 (file)
@@ -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());
                }
        }
 
index b1b943c2dc628a23ed37934c9e5a20b4c4f564d5..818941915a49d906b1c35e20250ad31587d202c3 100644 (file)
@@ -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;