Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ObjectIndexTest: improve getAll() test coverage
Specifically, we test that lazy object resolution works in conjunction
with a call to getAll(), to ensure that pending objects get resolved.
  • Loading branch information
ctrueden committed May 12, 2015
commit f4dce23411b9944930efc74e7c2a23ec1a6c4697
18 changes: 17 additions & 1 deletion src/test/java/org/scijava/object/ObjectIndexTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand All @@ -60,11 +62,25 @@ public void testGetAll() {
objectIndex.add(o1);
objectIndex.add(o2);
objectIndex.add(o3);

final String o4 = "quick", o5 = "brown", o6 = "fox";
objectIndex.addLater(new LazyObjects<String>() {

@Override
public Collection<String> get() {
return Arrays.asList(o4, o5, o6);
}

});

final List<Object> all = objectIndex.getAll();
assertEquals(3, all.size());
assertEquals(6, all.size());
assertSame(o1, all.get(0));
assertSame(o2, all.get(1));
assertSame(o3, all.get(2));
assertSame(o4, all.get(3));
assertSame(o5, all.get(4));
assertSame(o6, all.get(5));
}

@Test
Expand Down