From: James Moger Date: Fri, 18 Apr 2014 02:51:54 +0000 (-0400) Subject: [findbugs] Reorder asserts to avoid potential NPE in JGitUtilsTest X-Git-Tag: v1.5.0~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=74344a924e831284d222e4b71bc2f45bc7e4d32a;p=gitblit.git [findbugs] Reorder asserts to avoid potential NPE in JGitUtilsTest --- diff --git a/src/test/java/com/gitblit/tests/JGitUtilsTest.java b/src/test/java/com/gitblit/tests/JGitUtilsTest.java index 05bea915..68cb4f86 100644 --- a/src/test/java/com/gitblit/tests/JGitUtilsTest.java +++ b/src/test/java/com/gitblit/tests/JGitUtilsTest.java @@ -420,6 +420,11 @@ public class JGitUtilsTest extends GitblitUnitTest { String contentA = JGitUtils.getStringContent(repository, (RevTree) null, "java.java"); RevCommit commit = JGitUtils.getCommit(repository, Constants.HEAD); String contentB = JGitUtils.getStringContent(repository, commit.getTree(), "java.java"); + + assertTrue("ContentA is null!", contentA != null && contentA.length() > 0); + assertTrue("ContentB is null!", contentB != null && contentB.length() > 0); + assertTrue(contentA.equals(contentB)); + String contentC = JGitUtils.getStringContent(repository, commit.getTree(), "missing.txt"); // manually construct a blob, calculate the hash, lookup the hash in git @@ -429,9 +434,6 @@ public class JGitUtilsTest extends GitblitUnitTest { String sha1 = StringUtils.getSHA1(sb.toString()); String contentD = JGitUtils.getStringContent(repository, sha1); repository.close(); - assertTrue("ContentA is null!", contentA != null && contentA.length() > 0); - assertTrue("ContentB is null!", contentB != null && contentB.length() > 0); - assertTrue(contentA.equals(contentB)); assertNull(contentC); assertTrue(contentA.equals(contentD)); }