@Test(expected = IllegalStateException.class) public void testWorkingWithTableFromClosedDatabase() throws Exception { MyTableProvider provider1 = new MyTableProvider("database2"); MyTable table = provider1.createTable("newTable", typeList); provider1.close(); table.size(); }
@Test(expected = IllegalStateException.class) public void testRemoveTableFromClosedDatabase() throws Exception { MyTableProvider provider1 = new MyTableProvider("database2"); provider1.createTable("newTable", typeList); provider1.close(); provider1.removeTable("newTable"); }
@Test public void testGetClosedTable() throws Exception { MyTable table = provider.createTable("closed", typeList); table.close(); MyTable newTable = provider.getTable("closed"); Assert.assertFalse(newTable.equals(table)); Assert.assertNotNull(newTable); }
@Test public void testCreateExistingTable() throws Exception { provider.createTable("definitelyTheBestTable", typeList); }
@Test(expected = IllegalArgumentException.class) public void testCreateEmptyTypeListTable() throws Exception { ArrayList<Class<?>> empty = new ArrayList<Class<?>>(); provider.createTable("theBestTable", empty); }
@Test(expected = IllegalArgumentException.class) public void testCreateWithBadTypeListTable() throws Exception { ArrayList<Class<?>> badTypeList = new ArrayList<Class<?>>(); badTypeList.add(StringBuilder.class); provider.createTable("tableBetterThanTheLastOne", badTypeList); }
@Test(expected = IllegalArgumentException.class) public void testCreateNullTypeListTable() throws Exception { provider.createTable("goodTable", null); }
@Test(expected = IllegalArgumentException.class) public void testCreateNullNameTable() throws Exception { provider.createTable(null, typeList); }
@Test(expected = RuntimeException.class) public void testCreateTableWithDots() throws Exception { provider.createTable("..", typeList); }