aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/lib')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java29
1 files changed, 17 insertions, 12 deletions
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 2481e64997..a42027b584 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
@@ -58,7 +58,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
-import java.util.Map;
+import java.util.Optional;
import java.util.TreeSet;
import org.eclipse.jgit.lib.Ref.Storage;
@@ -148,17 +148,22 @@ public class RefTest extends SampleDataRepositoryTestCase {
ObjectId r = db.resolve("refs/remotes/origin/HEAD");
assertEquals(masterId, r);
- Map<String, Ref> allRefs = db.getAllRefs();
- Ref refHEAD = allRefs.get("refs/remotes/origin/HEAD");
- assertNotNull(refHEAD);
- assertEquals(masterId, refHEAD.getObjectId());
- assertFalse(refHEAD.isPeeled());
- assertNull(refHEAD.getPeeledObjectId());
-
- Ref refmaster = allRefs.get("refs/remotes/origin/master");
- assertEquals(masterId, refmaster.getObjectId());
- assertFalse(refmaster.isPeeled());
- assertNull(refmaster.getPeeledObjectId());
+ List<Ref> allRefs = db.getRefDatabase().getRefs();
+ Optional<Ref> refHEAD = allRefs.stream()
+ .filter(ref -> ref.getName().equals("refs/remotes/origin/HEAD"))
+ .findAny();
+ assertTrue(refHEAD.isPresent());
+ assertEquals(masterId, refHEAD.get().getObjectId());
+ assertFalse(refHEAD.get().isPeeled());
+ assertNull(refHEAD.get().getPeeledObjectId());
+
+ Optional<Ref> refmaster = allRefs.stream().filter(
+ ref -> ref.getName().equals("refs/remotes/origin/master"))
+ .findAny();
+ assertTrue(refmaster.isPresent());
+ assertEquals(masterId, refmaster.get().getObjectId());
+ assertFalse(refmaster.get().isPeeled());
+ assertNull(refmaster.get().getPeeledObjectId());
}
@Test