예제 #1
0
 @Test
 public void testRollback() throws Exception {
   testedTable.put("abc1", "1");
   testedTable.remove("abc1");
   testedTable.put("abc1", "2");
   Assert.assertEquals(testedTable.rollback(), 1);
   Assert.assertNull(testedTable.get("abc1"));
 }
예제 #2
0
 @Test
 public void testSize() throws Exception {
   int sizeBefore = testedTable.size();
   testedTable.put("abcdef1", "1");
   testedTable.put("abcdef2", "2");
   testedTable.put("abcdef1", "3");
   Assert.assertEquals(testedTable.size(), sizeBefore + 2);
 }
 @Override
 public boolean execute(String[] args) {
   Table table = manager.getCurrentTable();
   String oldValue = table.remove(args[1]);
   if (oldValue == null) {
     manager.printMessage("not found");
   } else {
     manager.printMessage("removed");
   }
   return true;
 }
예제 #4
0
 @Test
 public void testComplex() throws Exception {
   testedTable.put("testkey", "testvalue");
   Assert.assertEquals(testedTable.get("testkey"), "testvalue");
   testedTable.put("testkey", "testvalue2");
   Assert.assertEquals(testedTable.remove("testkey"), "testvalue2");
   Assert.assertNull(testedTable.get("abcd"));
   Assert.assertNull(testedTable.remove("abcd"));
 }
예제 #5
0
 @Test
 public void testCommit() throws Exception {
   testedTable.put("abcd1", "1");
   testedTable.put("abcd2", "2");
   Assert.assertEquals(testedTable.commit(), 2);
   Assert.assertEquals(testedTable.get("abcd1"), "1");
   testedTable.remove("abcd1");
   testedTable.remove("abcd2");
   Assert.assertEquals(testedTable.commit(), 2);
   Assert.assertNull(testedTable.get("abcd2"));
 }
예제 #6
0
 @Test(expected = IllegalArgumentException.class)
 public void testRemoveNull() throws Exception {
   testedTable.remove(null);
 }
예제 #7
0
 @Test(expected = IllegalArgumentException.class)
 public void testGetNl() throws Exception {
   testedTable.get("");
 }
예제 #8
0
 @Test
 public void testGetName() throws Exception {
   Assert.assertEquals(testedTable.getName(), TABLE_NAME);
 }