Beispiel #1
0
  public void testStructs() throws Exception {
    File tmp = new File("tmp");
    PersistentMap<X> pm = new PersistentMap<X>(new File(tmp, "simple"), X.class);
    try {
      X x = new X();
      x.abc = "def";
      x.def = 5;
      x.list.add("abc");
      assertNull(pm.put("abc", x));
      pm.close();

      PersistentMap<X> pm2 = new PersistentMap<X>(new File(tmp, "simple"), X.class);

      X x2 = pm2.get("abc");
      assertEquals("def", x2.abc);
      assertEquals(5, x2.def);

      pm2.remove("abc");

      assertEquals(0, pm2.size());

      pm2.close();
    } finally {
      pm.close();
      IO.delete(tmp);
    }
  }
  /** Example test method. */
  public void testMethod4() {
    X.println("Output from TestB.testMethod4().");

    throw new RuntimeException("Failed exception from TestB.testMethod4().");
  }
  /** Example test method. */
  public void testMethod3() {
    X.println("Output from TestB.testMethod3().");

    assertTrue("Failed assertion from TestB.testMethod3().", false);
  }
 /** Example test method. */
 public void testMethod2() {
   X.println("Output from TestB.testMethod2().");
 }
 /** {@inheritDoc} */
 @Override
 protected void tearDown() throws Exception {
   X.println("Tearing down test execution: " + getName());
 }
 /** {@inheritDoc} */
 @Override
 protected void setUp() throws Exception {
   X.println("Preparing for test execution: " + getName());
 }