コード例 #1
0
  @Test
  public void testAddCollaborator() {
    River river = riverDao.findById(1L);
    Account account = accountDao.findByUsernameOrEmail("user4");

    riverDao.addCollaborator(river, account, true);
    em.flush();

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

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