  @Test
  public void testFindAndLock() throws Exception {

    // Configure the mock because our class under test expects values to be returned from the db
    when(db.query(anyString(), anyString())).thenReturn(new RowStub()
        .withColumnNames("sample_name", "update_sequence", "update_time")
        .addRow("Foo", 3, now));

    // The test scenario
    Sample sample = sampleDao.findSampleById(15L, true);

    // Verify object in memory is updated properly
    assertEquals(new Long(15L), sample.getSampleId());
    assertEquals("Foo", sample.getName());
    assertEquals(new Integer(3), sample.getUpdateSequence());
    assertEquals(now, sample.getUpdateTime());

    // Verify database queries against golden copies
    verify(db).query(anyString(), eq("select sample_name, update_sequence, update_time from sample where sample_id=15 for update"));
    verifyNoMoreInteractions(db);
  }