@Test
public void testCreate() throws Exception {

  // Configure the mock because DAO expects the pk to be returned from the insert
  when(db.insertReturningPk(anyString(), anyString())).thenReturn(1L);
  Sample sample = new Sample();
  sample.setName("Foo");
  sampleDao.createSample(sample, 1L);
  // Verify object in memory is updated properly
  assertEquals(new Long(1L), sample.getSampleId());
  assertEquals("Foo", sample.getName());
  assertEquals(new Integer(0), sample.getUpdateSequence());
  assertEquals(now, sample.getUpdateTime());
  // Verify SQL executed against golden copies
  verify(db).insertReturningPk(eq("insert into sample (sample_id, sample_name, update_sequence, update_time) values (nextval('id_seq'),?,0,?)"), anyString());
  verify(db).insert(eq("insert into sample_history (sample_id, sample_name, update_sequence, update_time, update_user_id, is_deleted) values (?,?,0,?,?,'N')"), anyString());
  verifyNoMoreInteractions(db);
}