summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-04-17 22:51:54 -0400
committerJames Moger <james.moger@gitblit.com>2014-04-17 23:08:07 -0400
commit74344a924e831284d222e4b71bc2f45bc7e4d32a (patch)
tree05b6788ed55cf437fc2c5a4c868d556d65466688 /src
parent029354ff409b6ca52f5213bd77415ab8630d3b2a (diff)
downloadgitblit-74344a924e831284d222e4b71bc2f45bc7e4d32a.tar.gz
gitblit-74344a924e831284d222e4b71bc2f45bc7e4d32a.zip
[findbugs] Reorder asserts to avoid potential NPE in JGitUtilsTest
Diffstat (limited to 'src')
-rw-r--r--src/test/java/com/gitblit/tests/JGitUtilsTest.java8
1 files changed, 5 insertions, 3 deletions
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));
}