コード例 #1
0
  @Test
  public void findCollaboratorByAccount() {
    RiverCollaborator rc = riverDao.findCollaborator(1L, 4L);

    assertEquals(1L, (long) rc.getId());
    assertEquals(4L, rc.getAccount().getId());
  }
コード例 #2
0
  @Test
  public void testModifyCollaborator() {
    RiverCollaborator collaborator = riverCollaboratorDao.findById(1L);
    collaborator.setActive(false);
    collaborator.setReadOnly(true);
    riverDao.updateCollaborator(collaborator);
    em.flush();

    String sql =
        "SELECT river_id, account_id, collaborator_active, read_only FROM river_collaborators WHERE id = ?";
    Map<String, Object> results = this.jdbcTemplate.queryForMap(sql, 1L);

    assertEquals(false, results.get("collaborator_active"));
    assertEquals(true, results.get("read_only"));
  }