Program: 62022
Project: 62022
Buggy source:
@Test public void testInsert() throws Exception {
  DataHubKey key=new DataHubKey((short)1003);
  String channelName="String_Node_Str";
  byte[] data="String_Node_Str".getBytes();
  long millis=90210L;
  Optional<String> contentType=Optional.of("String_Node_Str");
  DataHubCompositeValue value=new DataHubCompositeValue(contentType,Optional.<String>absent(),data,millis);
  ValueInsertionResult expected=new ValueInsertionResult(key,null,null);
  DataHubKey lastUpdateKey=new DataHubKey((short)1000);
  CassandraChannelsCollection channelsCollection=mock(CassandraChannelsCollection.class);
  CassandraValueWriter inserter=mock(CassandraValueWriter.class);
  CassandraValueReader reader=mock(CassandraValueReader.class);
  ConcurrentMap<String,DataHubKey> lastUpdatedMap=mock(ConcurrentMap.class);
  TimeProvider timeProvider=mock(TimeProvider.class);
  LastKeyFinder lastUpdatedKeyFinder=mock(LastKeyFinder.class);
  when(timeProvider.getMillis()).thenReturn(millis);
  when(inserter.write(channelName,value,0)).thenReturn(new ValueInsertionResult(key,null,null));
  when(lastUpdatedKeyFinder.queryForLatestKey(channelName)).thenReturn(lastUpdateKey);
  CassandraChannelDao testClass=new CassandraChannelDao(channelsCollection,inserter,reader,lastUpdatedMap,lastUpdatedKeyFinder,null,timeProvider);
  ValueInsertionResult result=testClass.insert(channelName,contentType,Optional.<String>absent(),data);
  assertEquals(expected,result);
}

Fixed version (ground truth):
@Test public void testInsert() throws Exception {
  DataHubKey key=new DataHubKey((short)1003);
  String channelName="String_Node_Str";
  byte[] data="String_Node_Str".getBytes();
  long millis=90210L;
  Optional<String> contentType=Optional.of("String_Node_Str");
  DataHubCompositeValue value=new DataHubCompositeValue(contentType,Optional.<String>absent(),data,millis);
  ValueInsertionResult expected=new ValueInsertionResult(key,null,null);
  DataHubKey lastUpdateKey=new DataHubKey((short)1000);
  CassandraChannelsCollection channelsCollection=mock(CassandraChannelsCollection.class);
  CassandraValueWriter inserter=mock(CassandraValueWriter.class);
  CassandraValueReader reader=mock(CassandraValueReader.class);
  ConcurrentMap<String,DataHubKey> lastUpdatedMap=mock(ConcurrentMap.class);
  TimeProvider timeProvider=mock(TimeProvider.class);
  LastKeyFinder lastUpdatedKeyFinder=mock(LastKeyFinder.class);
  ChannelConfiguration channelConfig=mock(ChannelConfiguration.class);
  when(channelsCollection.getChannelConfiguration(channelName)).thenReturn(channelConfig);
  when(channelConfig.getTtlMillis()).thenReturn(millis);
  when(timeProvider.getMillis()).thenReturn(millis);
  when(inserter.write(channelName,value,Optional.of((int)millis / 1000))).thenReturn(new ValueInsertionResult(key,null,null));
  when(lastUpdatedKeyFinder.queryForLatestKey(channelName)).thenReturn(lastUpdateKey);
  CassandraChannelDao testClass=new CassandraChannelDao(channelsCollection,inserter,reader,lastUpdatedMap,lastUpdatedKeyFinder,null,timeProvider);
  ValueInsertionResult result=testClass.insert(channelName,contentType,Optional.<String>absent(),data);
  assertEquals(expected,result);
}