コード例 #1
0
  @Test
  public void testSaveOrUpdate() throws Exception {
    new AddressTestDataBuilder(databaseRule.getEntityManager()).buildAndSave();

    List<Address> loadAllObjects =
        databaseRule.getTransactionHelper().loadAllObjects(Address.class);

    assertEquals(1, loadAllObjects.size());
  }
コード例 #2
0
  @Test(expected = RuntimeException.class)
  public void testBuildAndSave_Unsuccessful() throws Exception {
    new AbstractTestdataBuilder<Person>(databaseRule.getEntityManager()) {

      @Override
      public Person build() {

        return null;
      }
    }.buildAndSave();
  }
コード例 #3
0
  @Test
  public void testHasEntityManager() throws Exception {

    assertFalse(new AddressTestDataBuilder().hasEntityManager());
    assertTrue(new AddressTestDataBuilder(databaseRule.getEntityManager()).hasEntityManager());
  }