MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / testIteratorBasic

Method testIteratorBasic

test/simpledb/HeapFileReadTest.java:84–106  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

82 }
83
84 @Test
85 public void testIteratorBasic() throws Exception {
86 HeapFile smallFile = SystemTestUtil.createRandomHeapFile(2, 3, null,
87 null);
88
89 DbFileIterator it = smallFile.iterator(tid);
90 // Not open yet
91 assertFalse(it.hasNext());
92 try {
93 it.next();
94 fail("expected exception");
95 } catch (NoSuchElementException ignored) {
96 }
97
98 it.open();
99 int count = 0;
100 while (it.hasNext()) {
101 assertNotNull(it.next());
102 count += 1;
103 }
104 assertEquals(3, count);
105 it.close();
106 }
107
108 @Test
109 public void testIteratorClose() throws Exception {

Callers

nothing calls this directly

Calls 6

createRandomHeapFileMethod · 0.95
iteratorMethod · 0.95
hasNextMethod · 0.95
nextMethod · 0.95
openMethod · 0.95
closeMethod · 0.95

Tested by

no test coverage detected