コード例 #1
0
  @Test
  public void testCreate() throws Exception {
    final EntityTransaction tx = entityManager.getTransaction();
    tx.begin();
    final User frank = createUser.create(new CredentialsVO("createdUser", "strongP@ass001"));
    tx.commit();

    final User persistedUser = entityManager.find(User.class, frank.getId());

    assertEquals("The right user was loaded from database", frank, persistedUser);
  }
コード例 #2
0
 @Test(expected = IllegalArgumentException.class)
 public void testCreateWithEmptyPassword() throws Exception {
   final User frank = createUser.create(new CredentialsVO("invalidUser", ""));
 }
コード例 #3
0
 @Test(expected = IllegalArgumentException.class)
 public void testCreateWithEmptyUsername() throws Exception {
   final User frank = createUser.create(new CredentialsVO("", "strongP@ass001"));
 }