use of com.zaxxer.hikari.mocks.StubStatement in project HikariCP by brettwooldridge.
the class TestFastList method testAddRemoveTail.
@Test
public void testAddRemoveTail() {
ArrayList<Statement> verifyList = new ArrayList<>();
FastList<Statement> list = new FastList<>(Statement.class);
for (int i = 0; i < 32; i++) {
StubStatement statement = new StubStatement(null);
list.add(statement);
verifyList.add(statement);
}
for (int i = 31; i >= 0; i--) {
assertNotNull("Element " + i, list.get(i));
int size = list.size();
list.remove(verifyList.get(i));
assertSame(size - 1, list.size());
}
}
use of com.zaxxer.hikari.mocks.StubStatement in project HikariCP by brettwooldridge.
the class TestFastList method testAddRemove.
@Test
public void testAddRemove() {
ArrayList<Statement> verifyList = new ArrayList<>();
FastList<Statement> list = new FastList<>(Statement.class);
for (int i = 0; i < 32; i++) {
StubStatement statement = new StubStatement(null);
list.add(statement);
verifyList.add(statement);
}
for (int i = 0; i < 32; i++) {
assertNotNull("Element " + i + " was null but should be " + verifyList.get(i), list.get(0));
int size = list.size();
list.remove(verifyList.get(i));
assertSame(size - 1, list.size());
}
}
use of com.zaxxer.hikari.mocks.StubStatement in project HikariCP by brettwooldridge.
the class TestFastList method testRemoveLast.
@Test
public void testRemoveLast() {
FastList<Statement> list = new FastList<>(Statement.class);
Statement last = null;
for (int i = 0; i < 100; i++) {
StubStatement statement = new StubStatement(null);
list.add(statement);
last = statement;
}
assertEquals(last, list.removeLast());
assertEquals(99, list.size());
}
use of com.zaxxer.hikari.mocks.StubStatement in project HikariCP by brettwooldridge.
the class TestFastList method testClear.
@Test
public void testClear() {
FastList<Statement> list = new FastList<>(Statement.class);
for (int i = 0; i < 100; i++) {
StubStatement statement = new StubStatement(null);
list.add(statement);
}
assertNotEquals(0, list.size());
list.clear();
assertEquals(0, list.size());
// also check that all elements are now null
for (int i = 0; i < 100; i++) {
assertEquals(null, list.get(i));
}
}
use of com.zaxxer.hikari.mocks.StubStatement in project HikariCP by brettwooldridge.
the class TestFastList method testIterator.
@Test
public void testIterator() {
FastList<Statement> list = new FastList<>(Statement.class);
for (int i = 0; i < 100; i++) {
StubStatement statement = new StubStatement(null);
list.add(statement);
}
Iterator<Statement> iter = list.iterator();
for (int i = 0; i < list.size(); i++) {
assertSame(list.get(i), iter.next());
}
}
Aggregations