コード例 #1
0
ファイル: PersistentMapTest.java プロジェクト: hemantgp/bnd
  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);
    }
  }
コード例 #2
0
  /** Example test method. */
  public void testMethod4() {
    X.println("Output from TestB.testMethod4().");

    throw new RuntimeException("Failed exception from TestB.testMethod4().");
  }
コード例 #3
0
  /** Example test method. */
  public void testMethod3() {
    X.println("Output from TestB.testMethod3().");

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