Esempio n. 1
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"));
 }
Esempio n. 2
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"));
 }
Esempio n. 3
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"));
 }
 @Override
 public boolean execute(String[] args) {
   Table table = manager.getCurrentTable();
   String value = table.get(args[1]);
   if (value == null) {
     manager.printMessage("not found");
   } else {
     manager.printMessage("found");
     manager.printMessage(value);
   }
   return true;
 }
Esempio n. 5
0
 @Test(expected = IllegalArgumentException.class)
 public void testGetNl() throws Exception {
   testedTable.get("");
 }