コード例 #1
0
  @Test
  public void testBulkPersistAndDelete() {
    List<Aluno> alunos = createListAluno();
    for (Aluno aluno : alunos) {
      alunoRepository.persist(aluno);
    }

    for (Aluno aluno : alunos) {
      Aluno alunoExpected = alunoRepository.getByEmail(aluno.getEmail());
      Assert.assertEquals(alunoExpected.getName(), aluno.getName());
      Assert.assertEquals(alunoExpected.getEmail(), aluno.getEmail());
      Assert.assertEquals(alunoExpected.getCreatedAt(), aluno.getCreatedAt());
    }

    for (Aluno aluno : alunos) {
      alunoRepository.delete(aluno);
    }

    // Test 1
    Assert.assertEquals(0, alunoRepository.getAll().size());

    // Test 2
    for (Aluno aluno : alunos) {
      Aluno alunoExpected = alunoRepository.getByEmail(aluno.getEmail());
      Assert.assertNull(alunoExpected);
    }
  }
コード例 #2
0
  @Test
  public void testPersistAndGetByEmail() {
    Aluno aluno = createAluno();
    alunoRepository.persist(aluno);

    Aluno alunoExpected = alunoRepository.getByEmail(aluno.getEmail());
    Assert.assertEquals(alunoExpected.getName(), aluno.getName());
    Assert.assertEquals(alunoExpected.getEmail(), aluno.getEmail());
    Assert.assertEquals(alunoExpected.getCreatedAt(), aluno.getCreatedAt());
  }
コード例 #3
0
  @Test
  public void testPersistAndGetAll() {
    Aluno aluno = createAluno();
    alunoRepository.persist(aluno);

    List<Aluno> alunosExpected = alunoRepository.getAll();
    for (Aluno alunoExpected : alunosExpected) {
      Assert.assertEquals(alunoExpected.getName(), aluno.getName());
      Assert.assertEquals(alunoExpected.getEmail(), aluno.getEmail());
      Assert.assertEquals(alunoExpected.getCreatedAt(), aluno.getCreatedAt());
    }
  }
コード例 #4
0
  @Test
  public void testBulkPersistAndGetByEmail() {
    List<Aluno> alunos = createListAluno();
    for (Aluno aluno : alunos) {
      alunoRepository.persist(aluno);
    }

    for (Aluno aluno : alunos) {
      Aluno alunoExpected = alunoRepository.getByEmail(aluno.getEmail());
      Assert.assertEquals(alunoExpected.getName(), aluno.getName());
      Assert.assertEquals(alunoExpected.getEmail(), aluno.getEmail());
      Assert.assertEquals(alunoExpected.getCreatedAt(), aluno.getCreatedAt());
    }
  }