nus-yam/ex-repair huggingface dataset:
Program: 186119
Project: 186119
Buggy source:
private Object readValue(JsonNode element) throws IOException, JsonParseException, JsonMappingException, ClassNotFoundException {
  Object readObject=null;
  JsonNode value=valueNode(element);
  String implementationValue=implementationClass(element);
  if (value.isArray()) {
    readObject=readArray(value,implementationValue);
  }
 else {
    readObject=readObject(value,implementationValue);
  }
  return readObject;
}

Fixed version (ground truth):
private Object readValue(JsonNode element) throws IOException, JsonParseException, JsonMappingException, ClassNotFoundException {
  JsonNode value=valueNode(element);
  String implementationValue=implementationClass(element);
  Object readObject=readElement(value,implementationValue);
  return readObject;
}
Program: 186120
Project: 186120
Buggy source:
private String keyValue(JsonNode element){
  String keyValue="String_Node_Str";
  if (element.has(KeyValueTokens.KEY_TOKEN)) {
    keyValue=element.path(KeyValueTokens.KEY_TOKEN).getTextValue();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + KeyValueTokens.KEY_TOKEN + "String_Node_Str");
  }
  return keyValue;
}

Fixed version (ground truth):
private Object keyValue(JsonNode element) throws JsonParseException, JsonMappingException, IOException, ClassNotFoundException {
  Object keyValue;
  if (element.has(KeyValueTokens.KEY_TOKEN)) {
    String implementationKey=implementationKeyClass(element);
    keyValue=readElement(element.path(KeyValueTokens.KEY_TOKEN),implementationKey);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + KeyValueTokens.KEY_TOKEN + "String_Node_Str");
  }
  return keyValue;
}
Program: 186121
Project: 186121
Buggy source:
public Map<String,Object> readValues(InputStream dataStream){
  Map<String,Object> objects=new HashMap<String,Object>();
  try {
    Iterator<JsonNode> elements=dataElements(dataStream);
    objects.putAll(readElements(elements));
  }
 catch (  JsonParseException e) {
    throw new IllegalArgumentException(e);
  }
catch (  JsonMappingException e) {
    throw new IllegalArgumentException(e);
  }
catch (  IOException e) {
    throw new IllegalArgumentException(e);
  }
catch (  ClassNotFoundException e) {
    throw new IllegalArgumentException("String_Node_Str",e);
  }
  return objects;
}

Fixed version (ground truth):
public Map<Object,Object> readValues(InputStream dataStream){
  Map<Object,Object> objects=new HashMap<Object,Object>();
  try {
    Iterator<JsonNode> elements=dataElements(dataStream);
    objects.putAll(readElements(elements));
  }
 catch (  JsonParseException e) {
    throw new IllegalArgumentException(e);
  }
catch (  JsonMappingException e) {
    throw new IllegalArgumentException(e);
  }
catch (  IOException e) {
    throw new IllegalArgumentException(e);
  }
catch (  ClassNotFoundException e) {
    throw new IllegalArgumentException("String_Node_Str",e);
  }
  return objects;
}
Program: 186122
Project: 186122
Buggy source:
private Map<String,Object> readElements(Iterator<JsonNode> elements) throws IOException, JsonParseException, JsonMappingException, ClassNotFoundException {
  Map<String,Object> objects=new HashMap<String,Object>();
  while (elements.hasNext()) {
    JsonNode element=elements.next();
    String keyValue=keyValue(element);
    Object readValue=readValue(element);
    objects.put(keyValue,readValue);
  }
  return objects;
}

Fixed version (ground truth):
private Map<Object,Object> readElements(Iterator<JsonNode> elements) throws IOException, JsonParseException, JsonMappingException, ClassNotFoundException {
  Map<Object,Object> objects=new HashMap<Object,Object>();
  while (elements.hasNext()) {
    JsonNode element=elements.next();
    Object keyValue=keyValue(element);
    Object readValue=readValue(element);
    objects.put(keyValue,readValue);
  }
  return objects;
}
Program: 186123
Project: 186123
Buggy source:
@Test public void native_data_should_be_read() throws JsonParseException, IOException, ClassNotFoundException {
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<String,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(SIMPLE_DATA.getBytes()));
  String readElement=(String)elements.get("String_Node_Str");
  assertThat(readElement,is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void native_data_should_be_read() throws JsonParseException, IOException, ClassNotFoundException {
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<Object,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(SIMPLE_DATA.getBytes()));
  String readElement=(String)elements.get("String_Node_Str");
  assertThat(readElement,is("String_Node_Str"));
}
Program: 186124
Project: 186124
Buggy source:
@Test public void array_of_objects_should_be_read_and_tranformed_to_instance(){
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<String,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(ARRAY_OF_OBJECTS_DATA.getBytes()));
  Set<User> readElements=(Set<User>)elements.get("String_Node_Str");
  assertThat(readElements,containsInAnyOrder(new User("String_Node_Str","String_Node_Str"),new User("String_Node_Str","String_Node_Str")));
}

Fixed version (ground truth):
@Test public void array_of_objects_should_be_read_and_tranformed_to_instance(){
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<Object,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(ARRAY_OF_OBJECTS_DATA.getBytes()));
  Set<User> readElements=(Set<User>)elements.get("String_Node_Str");
  assertThat(readElements,containsInAnyOrder(new User("String_Node_Str","String_Node_Str"),new User("String_Node_Str","String_Node_Str")));
}
Program: 186125
Project: 186125
Buggy source:
@Test public void native_data_should_be_read_as_integer() throws JsonParseException, IOException, ClassNotFoundException {
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<String,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(SIMPLE_DATA_INTEGER.getBytes()));
  Integer readElement=(Integer)elements.get("String_Node_Str");
  assertThat(readElement,is(1));
}

Fixed version (ground truth):
@Test public void native_data_should_be_read_as_integer() throws JsonParseException, IOException, ClassNotFoundException {
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<Object,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(SIMPLE_DATA_INTEGER.getBytes()));
  Integer readElement=(Integer)elements.get("String_Node_Str");
  assertThat(readElement,is(1));
}
Program: 186126
Project: 186126
Buggy source:
@Test public void array_of_elements_should_be_inserted_into_given_implementation_collection(){
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<String,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(SET_DATA.getBytes()));
  Set<String> readElements=(Set<String>)elements.get("String_Node_Str");
  assertThat(readElements,instanceOf(HashSet.class));
  assertThat(readElements,containsInAnyOrder("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
@Test public void array_of_elements_should_be_inserted_into_given_implementation_collection(){
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<Object,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(SET_DATA.getBytes()));
  Set<String> readElements=(Set<String>)elements.get("String_Node_Str");
  assertThat(readElements,instanceOf(HashSet.class));
  assertThat(readElements,containsInAnyOrder("String_Node_Str","String_Node_Str"));
}
Program: 186127
Project: 186127
Buggy source:
@Test public void array_of_elements_should_be_inserted_into_ArrayList_if_no_implementation_provided(){
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<String,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(ARRAY_DATA.getBytes()));
  List<String> readElements=(List<String>)elements.get("String_Node_Str");
  assertThat(readElements,instanceOf(ArrayList.class));
  assertThat(readElements,containsInAnyOrder("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
@Test public void array_of_elements_should_be_inserted_into_ArrayList_if_no_implementation_provided(){
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<Object,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(ARRAY_DATA.getBytes()));
  List<String> readElements=(List<String>)elements.get("String_Node_Str");
  assertThat(readElements,instanceOf(ArrayList.class));
  assertThat(readElements,containsInAnyOrder("String_Node_Str","String_Node_Str"));
}
Program: 186128
Project: 186128
Buggy source:
@Test public void object_data_should_be_read_and_transformed_to_instance(){
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<String,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(OBJECT_DATA.getBytes()));
  User readElement=(User)elements.get("String_Node_Str");
  assertThat(readElement,is(new User("String_Node_Str","String_Node_Str")));
}

Fixed version (ground truth):
@Test public void object_data_should_be_read_and_transformed_to_instance(){
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<Object,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(OBJECT_DATA.getBytes()));
  User readElement=(User)elements.get("String_Node_Str");
  assertThat(readElement,is(new User("String_Node_Str","String_Node_Str")));
}
Program: 186129
Project: 186129
Buggy source:
@Test(expected=IllegalArgumentException.class) public void an_exception_should_be_thrown_if_no_implementation_is_provided_in_objects(){
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<String,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(OBJECT_DATA_WITHOUT_IMPLEMENTATION.getBytes()));
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void an_exception_should_be_thrown_if_no_implementation_is_provided_in_objects(){
  KeyValueObjectMapper keyValueObjectMapper=new KeyValueObjectMapper();
  Map<Object,Object> elements=keyValueObjectMapper.readValues(new ByteArrayInputStream(OBJECT_DATA_WITHOUT_IMPLEMENTATION.getBytes()));
}
Program: 186130
Project: 186130
Buggy source:
private List<String> buildOperationSystemProgramAndArguments(){
  List<String> programAndArguments=new ArrayList<String>();
  programAndArguments.add(getExecutablePath());
  if (isReplicaSetNameSet()) {
    programAndArguments.add(REPLICA_SET_ARGUMENT_NAME);
    programAndArguments.add(this.replicaSetName);
  }
  programAndArguments.add(DBPATH_ARGUMENT_NAME);
  programAndArguments.add(dbRelativePath);
  programAndArguments.add(PORT_ARGUMENT_NAME);
  programAndArguments.add(Integer.toString(port));
  programAndArguments.add(LOGPATH_ARGUMENT_NAME);
  programAndArguments.add(logRelativePath);
  for (  String argument : this.singleCommandArguments) {
    programAndArguments.add(argument);
  }
  for (  String argumentName : this.extraCommandArguments.keySet()) {
    programAndArguments.add(argumentName);
    programAndArguments.add(this.extraCommandArguments.get(argumentName));
  }
  return programAndArguments;
}

Fixed version (ground truth):
private List<String> buildOperationSystemProgramAndArguments(){
  List<String> programAndArguments=new ArrayList<String>();
  programAndArguments.add(getExecutablePath());
  if (isReplicaSetNameSet()) {
    programAndArguments.add(REPLICA_SET_ARGUMENT_NAME);
    programAndArguments.add(this.replicaSetName);
  }
  programAndArguments.add(DBPATH_ARGUMENT_NAME);
  programAndArguments.add(dbRelativePath);
  programAndArguments.add(PORT_ARGUMENT_NAME);
  programAndArguments.add(Integer.toString(port));
  programAndArguments.add(LOGPATH_ARGUMENT_NAME);
  programAndArguments.add(logRelativePath);
  programAndArguments.add(journalingArgument());
  for (  String argument : this.singleCommandArguments) {
    programAndArguments.add(argument);
  }
  for (  String argumentName : this.extraCommandArguments.keySet()) {
    programAndArguments.add(argumentName);
    programAndArguments.add(this.extraCommandArguments.get(argumentName));
  }
  return programAndArguments;
}
Program: 186131
Project: 186131
Buggy source:
public void removeEmbeddedInstance(String targetPath){
  if (instances.containsKey(targetPath)) {
    this.instances.get(targetPath).remove();
  }
}

Fixed version (ground truth):
public void removeEmbeddedInstance(String targetPath){
  this.instances.remove(targetPath);
}
Program: 186132
Project: 186132
Buggy source:
public T getDefaultEmbeddedInstance(){
  ThreadLocal<T> currentThreadLocal=with(this.instances).values().first(anything());
  if (currentThreadLocal != null) {
    return currentThreadLocal.get();
  }
  return null;
}

Fixed version (ground truth):
public T getDefaultEmbeddedInstance(){
  T element=with(this.instances).values().first(anything());
  return element;
}
Program: 186133
Project: 186133
Buggy source:
public void addEmbeddedInstance(T embeddedInstance,String targetPath){
  if (!instances.containsKey(targetPath)) {
    this.instances.put(targetPath,new ThreadLocal<T>());
  }
  ThreadLocal<T> currentThreadLocal=this.instances.get(targetPath);
  currentThreadLocal.set(embeddedInstance);
  this.instances.put(targetPath,currentThreadLocal);
}

Fixed version (ground truth):
public void addEmbeddedInstance(T embeddedInstance,String targetPath){
  this.instances.put(targetPath,embeddedInstance);
}
Program: 186134
Project: 186134
Buggy source:
public T getEmbeddedByTargetPath(String targetPath){
  if (this.instances.containsKey(targetPath)) {
    return this.instances.get(targetPath).get();
  }
  return null;
}

Fixed version (ground truth):
public T getEmbeddedByTargetPath(String targetPath){
  if (this.instances.containsKey(targetPath)) {
    return this.instances.get(targetPath);
  }
  return null;
}
Program: 186135
Project: 186135
Buggy source:
private DB getMongoDb(){
  DB db=mongo.getDB(this.mongoDbConfiguration.getDatabaseName());
  if (this.mongoDbConfiguration.isAuthenticateParametersSet()) {
    boolean authenticated=db.authenticate(this.mongoDbConfiguration.getUsername(),this.mongoDbConfiguration.getPassword().toCharArray());
    if (!authenticated) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  return db;
}

Fixed version (ground truth):
private DB getMongoDb(){
  DB db=mongo.getDB(this.mongoDbConfiguration.getDatabaseName());
  if (this.mongoDbConfiguration.isAuthenticateParametersSet() && !db.isAuthenticated()) {
    boolean authenticated=db.authenticate(this.mongoDbConfiguration.getUsername(),this.mongoDbConfiguration.getPassword().toCharArray());
    if (!authenticated) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  return db;
}
Program: 186137
Project: 186137
Buggy source:
private void loadDataSet(UsingDataSet usingDataSet,FrameworkMethod method) throws IOException {
  String[] locations=usingDataSet.locations();
  List<InputStream> scriptContent=new ArrayList<InputStream>();
  scriptContent.addAll(loadGlobalDataSets(usingDataSet,method,locations));
  scriptContent.addAll(loadSelectiveDataSets(usingDataSet));
  LoadStrategyEnum loadStrategyEnum=usingDataSet.loadStrategy();
  LoadStrategyOperation loadStrategyOperation=loadStrategyFactory.getLoadStrategyInstance(loadStrategyEnum,getDatabaseOperation());
  loadStrategyOperation.executeScripts(scriptContent.toArray(new InputStream[scriptContent.size()]));
}

Fixed version (ground truth):
private void loadDataSet(UsingDataSet usingDataSet,FrameworkMethod method) throws IOException {
  List<InputStream> scriptContent=loadDatasets(usingDataSet,method);
  LoadStrategyEnum loadStrategyEnum=usingDataSet.loadStrategy();
  if (areDatasetsRequired(loadStrategyEnum) && emptyDataset(scriptContent)) {
    final String suffix="String_Node_Str" + getWorkingExtension();
    final String defaultClassLocation=DefaultClasspathLocationBuilder.defaultClassAnnotatedClasspathLocation(method);
    final String defaultMethodLocation=DefaultClasspathLocationBuilder.defaultMethodAnnotatedClasspathLocation(method,defaultClassLocation,suffix);
    throw new IllegalArgumentException("String_Node_Str" + defaultClassLocation + suffix+ "String_Node_Str"+ defaultMethodLocation);
  }
  LoadStrategyOperation loadStrategyOperation=loadStrategyFactory.getLoadStrategyInstance(loadStrategyEnum,getDatabaseOperation());
  loadStrategyOperation.executeScripts(scriptContent.toArray(new InputStream[scriptContent.size()]));
}
Program: 186138
Project: 186138
Buggy source:
private void assertExpectation(ShouldMatchDataSet shouldMatchDataSet) throws IOException {
  InputStream scriptContent=loadExpectedContentScript(method,shouldMatchDataSet);
  if (isNotEmptyStream(scriptContent)) {
    getDatabaseOperation().databaseIs(scriptContent);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void assertExpectation(ShouldMatchDataSet shouldMatchDataSet) throws IOException {
  InputStream scriptContent=loadExpectedContentScript(method,shouldMatchDataSet);
  if (isNotEmptyStream(scriptContent)) {
    getDatabaseOperation().databaseIs(scriptContent);
  }
 else {
    final String suffix=EXPECTED_RESERVED_WORD + "String_Node_Str" + getWorkingExtension();
    final String defaultClassLocation=DefaultClasspathLocationBuilder.defaultClassAnnotatedClasspathLocation(method);
    final String defaultMethodLocation=DefaultClasspathLocationBuilder.defaultMethodAnnotatedClasspathLocation(method,defaultClassLocation,suffix);
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + defaultClassLocation + suffix+ "String_Node_Str"+ defaultMethodLocation);
  }
}
Program: 186139
Project: 186139
Buggy source:
private static void checkColumns(List<ColumnFamilyModel> expectedColumnFamilies,Keyspace keyspace,KeyspaceDefinition keyspaceDefinition){
  List<ColumnFamilyDefinition> columnFamilyDefinitions=keyspaceDefinition.getCfDefs();
  for (  ColumnFamilyModel expectedColumnFamilyModel : expectedColumnFamilies) {
    ColumnFamilyDefinition columnFamily=checkColumnFamilyName(columnFamilyDefinitions,expectedColumnFamilyModel);
    ColumnType columnType=checkColumnFamilyType(expectedColumnFamilyModel,columnFamily);
    String expectedColumnFamilyName=expectedColumnFamilyModel.getName();
    List<RowModel> expectedRows=expectedColumnFamilyModel.getRows();
    checkNumberOfRowsIntoColumnFamily(keyspace,expectedColumnFamilyName,expectedRows.size());
    if (ColumnType.STANDARD == columnType) {
      for (      RowModel expectedRowModel : expectedRows) {
        checkStandardColumns(keyspace,expectedColumnFamilyName,expectedRowModel);
      }
    }
 else {
      if (ColumnType.SUPER == columnType) {
        for (        RowModel expectedRowModel : expectedRows) {
          List<ColumnModel> expectedColumns=expectedRowModel.getColumns();
          checkNotStandardColumnsInSuperColumns(expectedRowModel,expectedColumns.size());
          checkSuperColumns(keyspace,expectedColumnFamilyName,expectedRowModel);
        }
      }
 else {
        throw new IllegalArgumentException("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
private static void checkColumns(List<ColumnFamilyModel> expectedColumnFamilies,Keyspace keyspace,KeyspaceDefinition keyspaceDefinition){
  List<ColumnFamilyDefinition> columnFamilyDefinitions=keyspaceDefinition.getCfDefs();
  for (  ColumnFamilyModel expectedColumnFamilyModel : expectedColumnFamilies) {
    ColumnFamilyDefinition columnFamily=checkColumnFamilyName(columnFamilyDefinitions,expectedColumnFamilyModel);
    ColumnType columnType=checkColumnFamilyType(expectedColumnFamilyModel,columnFamily);
    String expectedColumnFamilyName=expectedColumnFamilyModel.getName();
    List<RowModel> expectedRows=expectedColumnFamilyModel.getRows();
    checkNumberOfRowsIntoColumnFamily(keyspace,expectedColumnFamilyName,expectedRows.size());
    if (ColumnType.STANDARD == columnType) {
      for (      RowModel expectedRowModel : expectedRows) {
        checkStandardColumns(keyspace,expectedColumnFamilyModel,expectedRowModel);
      }
    }
 else {
      if (ColumnType.SUPER == columnType) {
        for (        RowModel expectedRowModel : expectedRows) {
          List<ColumnModel> expectedColumns=expectedRowModel.getColumns();
          checkNotStandardColumnsInSuperColumns(expectedRowModel,expectedColumns.size());
          checkSuperColumns(keyspace,expectedColumnFamilyModel,expectedRowModel);
        }
      }
 else {
        throw new IllegalArgumentException("String_Node_Str");
      }
    }
  }
}
Program: 186141
Project: 186141
Buggy source:
private static void checkStandardColumns(Keyspace keyspace,String expectedColumnFamilyName,RowModel expectedRowModel) throws Error {
  checkNumberOfColumns(keyspace,expectedColumnFamilyName,expectedRowModel);
  List<ColumnModel> expectedColumns=expectedRowModel.getColumns();
  for (  ColumnModel expectedColumnModel : expectedColumns) {
    ColumnQuery<byte[],byte[],byte[]> columnQuery=HFactory.createColumnQuery(keyspace,BytesArraySerializer.get(),BytesArraySerializer.get(),BytesArraySerializer.get());
    columnQuery.setColumnFamily(expectedColumnFamilyName).setKey(getBytes(expectedRowModel.getKey())).setName(getBytes(expectedColumnModel.getName()));
    QueryResult<HColumn<byte[],byte[]>> result=columnQuery.execute();
    HColumn<byte[],byte[]> hColumn=result.get();
    checkColumnName(expectedColumnModel,hColumn);
    checkColumnValue(expectedRowModel,hColumn);
  }
}

Fixed version (ground truth):
private static void checkStandardColumns(Keyspace keyspace,ColumnFamilyModel expectedColumnFamilyModel,RowModel expectedRowModel) throws Error {
  String expectedColumnFamilyName=expectedColumnFamilyModel.getName();
  checkNumberOfColumns(keyspace,expectedColumnFamilyName,expectedRowModel);
  List<ColumnModel> expectedColumns=expectedRowModel.getColumns();
  for (  ColumnModel expectedColumnModel : expectedColumns) {
    if (expectedColumnFamilyModel.isCounter()) {
      checkCounterColumn(keyspace,expectedRowModel,expectedColumnFamilyName,expectedColumnModel);
    }
 else {
      checkColumn(keyspace,expectedRowModel,expectedColumnFamilyName,expectedColumnModel);
    }
  }
}
Program: 186142
Project: 186142
Buggy source:
private void dropKeyspaces(){
  List<KeyspaceDefinition> keyspaces=cluster.describeKeyspaces();
  for (  KeyspaceDefinition keyspaceDefinition : keyspaces) {
    String keyspaceName=keyspaceDefinition.getName();
    if (!INTERNAL_CASSANDRA_KEYSPACE.equals(keyspaceName)) {
      cluster.dropKeyspace(keyspaceName);
    }
  }
  List<KeyspaceDefinition> keyspaces2=cluster.describeKeyspaces();
}

Fixed version (ground truth):
private void dropKeyspaces(){
  List<KeyspaceDefinition> keyspaces=cluster.describeKeyspaces();
  for (  KeyspaceDefinition keyspaceDefinition : keyspaces) {
    String keyspaceName=keyspaceDefinition.getName();
    if (!INTERNAL_CASSANDRA_KEYSPACE.equals(keyspaceName)) {
      cluster.dropKeyspace(keyspaceName,true);
    }
  }
  List<KeyspaceDefinition> keyspaces2=cluster.describeKeyspaces();
}
Program: 186143
Project: 186143
Buggy source:
private List<String> buildOperationSystemProgramAndArguments(){
  List<String> programAndArguments=new ArrayList<String>();
  programAndArguments.add(getExecutablePath());
  programAndArguments.add(FOREGROUND_ARGUMENT_NAME);
  for (  String argument : this.singleCommandArguments) {
    programAndArguments.add(argument);
  }
  for (  String argumentName : this.extraCommandArguments.keySet()) {
    programAndArguments.add(argumentName);
    programAndArguments.add(this.extraCommandArguments.get(argumentName));
  }
  return programAndArguments;
}

Fixed version (ground truth):
private List<String> buildOperationSystemProgramAndArguments(){
  List<String> programAndArguments=new ArrayList<String>();
  programAndArguments.add(getExecutablePath());
  programAndArguments.add("String_Node_Str");
  programAndArguments.add(FOREGROUND_ARGUMENT_NAME);
  for (  String argument : this.singleCommandArguments) {
    programAndArguments.add(argument);
  }
  for (  String argumentName : this.extraCommandArguments.keySet()) {
    programAndArguments.add(argumentName);
    programAndArguments.add(this.extraCommandArguments.get(argumentName));
  }
  return programAndArguments;
}
Program: 186144
Project: 186144
Buggy source:
private List<String> startCassandraProcess() throws InterruptedException {
  try {
    pwd=startProcess();
    pwd.waitFor();
    if (pwd.exitValue() != 0) {
      List<String> consoleOutput=getConsoleOutput(pwd);
      throw new IllegalStateException("String_Node_Str" + cassandraPath + "String_Node_Str"+ port+ "String_Node_Str"+ consoleOutput);
    }
    return null;
  }
 catch (  IOException e) {
    throw new IllegalStateException("String_Node_Str" + cassandraPath + "String_Node_Str"+ port+ "String_Node_Str");
  }
}

Fixed version (ground truth):
private List<String> startCassandraProcess() throws InterruptedException {
  try {
    pwd=startProcess();
    pwd.waitFor();
    if (pwd.exitValue() != 0) {
      List<String> consoleOutput=getConsoleOutput(pwd);
      System.out.println(consoleOutput);
    }
    return null;
  }
 catch (  IOException e) {
    throw new IllegalStateException("String_Node_Str" + cassandraPath + "String_Node_Str"+ port+ "String_Node_Str");
  }
}
Program: 186145
Project: 186145
Buggy source:
@Test public void cassandra_should_be_started_in_Linux() throws Throwable {
  System.setProperty("String_Node_Str","String_Node_Str");
  when(operatingSystemResolver.currentOperatingSystem()).thenReturn(OperatingSystem.LINUX_OS);
  CommandLineExecutor commandLineExecutor=mock(CommandLineExecutor.class);
  Process mockProcess=mock(Process.class);
  when(mockProcess.exitValue()).thenReturn(0);
  when(commandLineExecutor.startProcessInDirectoryAndArguments(anyString(),anyList())).thenReturn(mockProcess);
  ManagedCassandra managedCassandra=newManagedCassandraRule().port(9191).build();
  managedCassandra.setCommandLineExecutor(commandLineExecutor);
  managedCassandra.setOperatingSystemResolver(operatingSystemResolver);
  managedCassandra.before();
  List<String> expectedCommand=new ArrayList<String>();
  expectedCommand.add("String_Node_Str" + File.separatorChar + ManagedCassandra.CASSANDRA_BINARY_DIRECTORY+ File.separatorChar+ ManagedCassandra.CASSANDRA_EXECUTABLE_X);
  expectedCommand.add(ManagedCassandra.FOREGROUND_ARGUMENT_NAME);
  managedCassandra.after();
  verify(commandLineExecutor).startProcessInDirectoryAndArguments(ManagedCassandra.DEFAULT_CASSANDRA_TARGET_PATH,expectedCommand);
  System.clearProperty("String_Node_Str");
}

Fixed version (ground truth):
@Test public void cassandra_should_be_started_in_Linux() throws Throwable {
  System.setProperty("String_Node_Str","String_Node_Str");
  when(operatingSystemResolver.currentOperatingSystem()).thenReturn(OperatingSystem.LINUX_OS);
  CommandLineExecutor commandLineExecutor=mock(CommandLineExecutor.class);
  Process mockProcess=mock(Process.class);
  when(mockProcess.exitValue()).thenReturn(0);
  when(commandLineExecutor.startProcessInDirectoryAndArguments(anyString(),anyList())).thenReturn(mockProcess);
  ManagedCassandra managedCassandra=newManagedCassandraRule().port(9191).build();
  managedCassandra.setCommandLineExecutor(commandLineExecutor);
  managedCassandra.setOperatingSystemResolver(operatingSystemResolver);
  managedCassandra.before();
  List<String> expectedCommand=new ArrayList<String>();
  expectedCommand.add("String_Node_Str" + File.separatorChar + ManagedCassandra.CASSANDRA_BINARY_DIRECTORY+ File.separatorChar+ ManagedCassandra.CASSANDRA_EXECUTABLE_X);
  expectedCommand.add("String_Node_Str");
  expectedCommand.add(ManagedCassandra.FOREGROUND_ARGUMENT_NAME);
  managedCassandra.after();
  verify(commandLineExecutor).startProcessInDirectoryAndArguments(ManagedCassandra.DEFAULT_CASSANDRA_TARGET_PATH,expectedCommand);
  System.clearProperty("String_Node_Str");
}
Program: 186146
Project: 186146
Buggy source:
@Test public void cassandra_should_be_started_in_Windows() throws Throwable {
  System.setProperty("String_Node_Str","String_Node_Str");
  when(operatingSystemResolver.currentOperatingSystem()).thenReturn(OperatingSystem.WINDOWS_7);
  CommandLineExecutor commandLineExecutor=mock(CommandLineExecutor.class);
  Process mockProcess=mock(Process.class);
  when(mockProcess.exitValue()).thenReturn(0);
  when(commandLineExecutor.startProcessInDirectoryAndArguments(anyString(),anyList())).thenReturn(mockProcess);
  ManagedCassandra managedCassandra=newManagedCassandraRule().port(9191).build();
  managedCassandra.setCommandLineExecutor(commandLineExecutor);
  managedCassandra.setOperatingSystemResolver(operatingSystemResolver);
  managedCassandra.before();
  List<String> expectedCommand=new ArrayList<String>();
  expectedCommand.add("String_Node_Str" + File.separatorChar + ManagedCassandra.CASSANDRA_BINARY_DIRECTORY+ File.separatorChar+ ManagedCassandra.CASSANDRA_EXECUTABLE_W);
  expectedCommand.add(ManagedCassandra.FOREGROUND_ARGUMENT_NAME);
  managedCassandra.after();
  verify(commandLineExecutor).startProcessInDirectoryAndArguments(ManagedCassandra.DEFAULT_CASSANDRA_TARGET_PATH,expectedCommand);
  System.clearProperty("String_Node_Str");
}

Fixed version (ground truth):
@Test public void cassandra_should_be_started_in_Windows() throws Throwable {
  System.setProperty("String_Node_Str","String_Node_Str");
  when(operatingSystemResolver.currentOperatingSystem()).thenReturn(OperatingSystem.WINDOWS_7);
  CommandLineExecutor commandLineExecutor=mock(CommandLineExecutor.class);
  Process mockProcess=mock(Process.class);
  when(mockProcess.exitValue()).thenReturn(0);
  when(commandLineExecutor.startProcessInDirectoryAndArguments(anyString(),anyList())).thenReturn(mockProcess);
  ManagedCassandra managedCassandra=newManagedCassandraRule().port(9191).build();
  managedCassandra.setCommandLineExecutor(commandLineExecutor);
  managedCassandra.setOperatingSystemResolver(operatingSystemResolver);
  managedCassandra.before();
  List<String> expectedCommand=new ArrayList<String>();
  expectedCommand.add("String_Node_Str" + File.separatorChar + ManagedCassandra.CASSANDRA_BINARY_DIRECTORY+ File.separatorChar+ ManagedCassandra.CASSANDRA_EXECUTABLE_W);
  expectedCommand.add("String_Node_Str");
  expectedCommand.add(ManagedCassandra.FOREGROUND_ARGUMENT_NAME);
  managedCassandra.after();
  verify(commandLineExecutor).startProcessInDirectoryAndArguments(ManagedCassandra.DEFAULT_CASSANDRA_TARGET_PATH,expectedCommand);
  System.clearProperty("String_Node_Str");
}
Program: 186147
Project: 186147
Buggy source:
@Test public void cassandra_should_be_started_in_Linux_from_custom_location() throws Throwable {
  when(operatingSystemResolver.currentOperatingSystem()).thenReturn(OperatingSystem.LINUX_OS);
  CommandLineExecutor commandLineExecutor=mock(CommandLineExecutor.class);
  Process mockProcess=mock(Process.class);
  when(mockProcess.exitValue()).thenReturn(0);
  when(commandLineExecutor.startProcessInDirectoryAndArguments(anyString(),anyList())).thenReturn(mockProcess);
  ManagedCassandra managedCassandra=newManagedCassandraRule().cassandraPath("String_Node_Str").port(9191).build();
  managedCassandra.setCommandLineExecutor(commandLineExecutor);
  managedCassandra.setOperatingSystemResolver(operatingSystemResolver);
  managedCassandra.before();
  List<String> expectedCommand=new ArrayList<String>();
  expectedCommand.add("String_Node_Str" + File.separatorChar + ManagedCassandra.CASSANDRA_BINARY_DIRECTORY+ File.separatorChar+ ManagedCassandra.CASSANDRA_EXECUTABLE_X);
  expectedCommand.add(ManagedCassandra.FOREGROUND_ARGUMENT_NAME);
  managedCassandra.after();
  verify(commandLineExecutor).startProcessInDirectoryAndArguments(ManagedCassandra.DEFAULT_CASSANDRA_TARGET_PATH,expectedCommand);
}

Fixed version (ground truth):
@Test public void cassandra_should_be_started_in_Linux_from_custom_location() throws Throwable {
  when(operatingSystemResolver.currentOperatingSystem()).thenReturn(OperatingSystem.LINUX_OS);
  CommandLineExecutor commandLineExecutor=mock(CommandLineExecutor.class);
  Process mockProcess=mock(Process.class);
  when(mockProcess.exitValue()).thenReturn(0);
  when(commandLineExecutor.startProcessInDirectoryAndArguments(anyString(),anyList())).thenReturn(mockProcess);
  ManagedCassandra managedCassandra=newManagedCassandraRule().cassandraPath("String_Node_Str").port(9191).build();
  managedCassandra.setCommandLineExecutor(commandLineExecutor);
  managedCassandra.setOperatingSystemResolver(operatingSystemResolver);
  managedCassandra.before();
  List<String> expectedCommand=new ArrayList<String>();
  expectedCommand.add("String_Node_Str" + File.separatorChar + ManagedCassandra.CASSANDRA_BINARY_DIRECTORY+ File.separatorChar+ ManagedCassandra.CASSANDRA_EXECUTABLE_X);
  expectedCommand.add("String_Node_Str");
  expectedCommand.add(ManagedCassandra.FOREGROUND_ARGUMENT_NAME);
  managedCassandra.after();
  verify(commandLineExecutor).startProcessInDirectoryAndArguments(ManagedCassandra.DEFAULT_CASSANDRA_TARGET_PATH,expectedCommand);
}
Program: 186148
Project: 186148
Buggy source:
@Test public void cassandra_should_be_started_in_MacOsX() throws Throwable {
  System.setProperty("String_Node_Str","String_Node_Str");
  when(operatingSystemResolver.currentOperatingSystem()).thenReturn(OperatingSystem.MAC_OSX);
  CommandLineExecutor commandLineExecutor=mock(CommandLineExecutor.class);
  Process mockProcess=mock(Process.class);
  when(mockProcess.exitValue()).thenReturn(0);
  when(commandLineExecutor.startProcessInDirectoryAndArguments(anyString(),anyList())).thenReturn(mockProcess);
  ManagedCassandra managedCassandra=newManagedCassandraRule().port(9191).build();
  managedCassandra.setCommandLineExecutor(commandLineExecutor);
  managedCassandra.setOperatingSystemResolver(operatingSystemResolver);
  managedCassandra.before();
  List<String> expectedCommand=new ArrayList<String>();
  expectedCommand.add("String_Node_Str" + File.separatorChar + ManagedCassandra.CASSANDRA_BINARY_DIRECTORY+ File.separatorChar+ ManagedCassandra.CASSANDRA_EXECUTABLE_X);
  expectedCommand.add(ManagedCassandra.FOREGROUND_ARGUMENT_NAME);
  managedCassandra.after();
  verify(commandLineExecutor).startProcessInDirectoryAndArguments(ManagedCassandra.DEFAULT_CASSANDRA_TARGET_PATH,expectedCommand);
  System.clearProperty("String_Node_Str");
}

Fixed version (ground truth):
@Test public void cassandra_should_be_started_in_MacOsX() throws Throwable {
  System.setProperty("String_Node_Str","String_Node_Str");
  when(operatingSystemResolver.currentOperatingSystem()).thenReturn(OperatingSystem.MAC_OSX);
  CommandLineExecutor commandLineExecutor=mock(CommandLineExecutor.class);
  Process mockProcess=mock(Process.class);
  when(mockProcess.exitValue()).thenReturn(0);
  when(commandLineExecutor.startProcessInDirectoryAndArguments(anyString(),anyList())).thenReturn(mockProcess);
  ManagedCassandra managedCassandra=newManagedCassandraRule().port(9191).build();
  managedCassandra.setCommandLineExecutor(commandLineExecutor);
  managedCassandra.setOperatingSystemResolver(operatingSystemResolver);
  managedCassandra.before();
  List<String> expectedCommand=new ArrayList<String>();
  expectedCommand.add("String_Node_Str" + File.separatorChar + ManagedCassandra.CASSANDRA_BINARY_DIRECTORY+ File.separatorChar+ ManagedCassandra.CASSANDRA_EXECUTABLE_X);
  expectedCommand.add("String_Node_Str");
  expectedCommand.add(ManagedCassandra.FOREGROUND_ARGUMENT_NAME);
  managedCassandra.after();
  verify(commandLineExecutor).startProcessInDirectoryAndArguments(ManagedCassandra.DEFAULT_CASSANDRA_TARGET_PATH,expectedCommand);
  System.clearProperty("String_Node_Str");
}
Program: 186149
Project: 186149
Buggy source:
private void dropStructure(){
  Cluster cluster=HFactory.getOrCreateCluster("String_Node_Str","String_Node_Str");
  KeyspaceDefinition keyspaceDef=cluster.describeKeyspace("String_Node_Str");
  if (keyspaceDef != null) {
    cluster.dropKeyspace("String_Node_Str");
  }
}

Fixed version (ground truth):
private void dropStructure(Cluster cluster){
  KeyspaceDefinition keyspaceDef=cluster.describeKeyspace("String_Node_Str");
  if (keyspaceDef != null) {
    cluster.dropKeyspace("String_Node_Str");
  }
}
Program: 186150
Project: 186150
Buggy source:
@Test public void cassandra_process_should_be_started(){
  createStructure();
  ColumnFamilyTemplate<String,String> columnFamilyTemplate=columnFamilyTemplate("String_Node_Str","String_Node_Str","String_Node_Str");
  Mutator<String> mutator=columnFamilyTemplate.createMutator();
  mutator.insert("String_Node_Str","String_Node_Str",HFactory.createStringColumn("String_Node_Str","String_Node_Str"));
  ColumnFamilyResult<String,String> res=columnFamilyTemplate.queryColumns("String_Node_Str");
  String value=res.getString("String_Node_Str");
  assertThat(value,is("String_Node_Str"));
  dropStructure();
}

Fixed version (ground truth):
@Test public void cassandra_process_should_be_started(){
  try {
    CassandraOperation cassandraOperation=new CassandraOperation(new CassandraConfiguration("String_Node_Str","String_Node_Str",9160));
    cassandraOperation.insert(new ByteArrayInputStream(INSERT_DATA.getBytes()));
    cassandraOperation.deleteAll();
  }
 catch (  Throwable t) {
    t.printStackTrace();
    Assert.fail();
  }
}
Program: 186151
Project: 186151
Buggy source:
private void createStructure(){
  Cluster cluster=HFactory.getOrCreateCluster("String_Node_Str","String_Node_Str");
  dropStructure();
  ColumnFamilyDefinition cfDef=HFactory.createColumnFamilyDefinition("String_Node_Str","String_Node_Str",ComparatorType.BYTESTYPE);
  KeyspaceDefinition newKeyspace=HFactory.createKeyspaceDefinition("String_Node_Str",ThriftKsDef.DEF_STRATEGY_CLASS,1,Arrays.asList(cfDef));
  cluster.addKeyspace(newKeyspace,true);
}

Fixed version (ground truth):
private void createStructure(Cluster cluster){
  dropStructure(cluster);
  ColumnFamilyDefinition cfDef=HFactory.createColumnFamilyDefinition("String_Node_Str","String_Node_Str",ComparatorType.BYTESTYPE);
  KeyspaceDefinition keyspaceDef=cluster.describeKeyspace("String_Node_Str");
  if (keyspaceDef == null) {
    KeyspaceDefinition newKeyspace=HFactory.createKeyspaceDefinition("String_Node_Str",ThriftKsDef.DEF_STRATEGY_CLASS,1,Arrays.asList(cfDef));
    cluster.addKeyspace(newKeyspace,true);
  }
}
Program: 186152
Project: 186152
Buggy source:
private ColumnFamilyTemplate<String,String> columnFamilyTemplate(String clusterName,String host,String keyspaceName){
  Cluster cluster=HFactory.getOrCreateCluster(clusterName,host);
  Keyspace keyspace=HFactory.createKeyspace(keyspaceName,cluster);
  return new ThriftColumnFamilyTemplate<String,String>(keyspace,"String_Node_Str",StringSerializer.get(),StringSerializer.get());
}

Fixed version (ground truth):
private ColumnFamilyTemplate<String,String> columnFamilyTemplate(Cluster cluster,String clusterName,String host,String keyspaceName){
  Keyspace keyspace=HFactory.createKeyspace(keyspaceName,cluster);
  return new ThriftColumnFamilyTemplate<String,String>(keyspace,"String_Node_Str",StringSerializer.get(),StringSerializer.get());
}
Program: 186153
Project: 186153
Buggy source:
@Override protected int getPort(){
  return PORT;
}

Fixed version (ground truth):
@Override protected int getPort(){
  return port;
}
Program: 186154
Project: 186154
Buggy source:
@Test public void embedded_cassandra_should_be_configured_with_default_parameters(){
  CassandraConfiguration embeddedConfiguration=newEmbeddedCassandraConfiguration().clusterName("String_Node_Str").build();
  assertThat(embeddedConfiguration.getClusterName(),is("String_Node_Str"));
  assertThat(embeddedConfiguration.getHost(),is("String_Node_Str"));
  assertThat(embeddedConfiguration.getPort(),is(EmbeddedCassandra.PORT));
}

Fixed version (ground truth):
@Test public void embedded_cassandra_should_be_configured_with_default_parameters(){
  CassandraConfiguration embeddedConfiguration=newEmbeddedCassandraConfiguration().clusterName("String_Node_Str").build();
  assertThat(embeddedConfiguration.getClusterName(),is("String_Node_Str"));
  assertThat(embeddedConfiguration.getHost(),is("String_Node_Str"));
  assertThat(embeddedConfiguration.getPort(),is(EmbeddedCassandra.DEFAULT_PORT));
}
Program: 186155
Project: 186155
Buggy source:
@Test public void embedded_parameter_values_should_contain_default_values(){
  CassandraConfiguration embeddedConfiguration=newEmbeddedCassandraConfiguration().clusterName("String_Node_Str").build();
  assertThat(embeddedConfiguration.getHost(),is("String_Node_Str"));
  assertThat(embeddedConfiguration.getPort(),is(EmbeddedCassandra.PORT));
  assertThat(embeddedConfiguration.getClusterName(),is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void embedded_parameter_values_should_contain_default_values(){
  CassandraConfiguration embeddedConfiguration=newEmbeddedCassandraConfiguration().clusterName("String_Node_Str").build();
  assertThat(embeddedConfiguration.getHost(),is("String_Node_Str"));
  assertThat(embeddedConfiguration.getPort(),is(EmbeddedCassandra.DEFAULT_PORT));
  assertThat(embeddedConfiguration.getClusterName(),is("String_Node_Str"));
}
Program: 186156
Project: 186156
Buggy source:
@Test public void embedded_cassandra_should_be_registered_and_started_with_custom_parameters() throws Throwable {
  EmbeddedCassandra cassandraRule=newEmbeddedCassandraRule().targetPath("String_Node_Str").cassandraConfigurationPath("String_Node_Str").build();
  cassandraRule.setEmbeddedCassandraServerHelper(embeddedCassandraServerHelper);
  Statement noStatement=new Statement(){
    @Override public void evaluate() throws Throwable {
      assertThat(ConnectionManagement.getInstance().isConnectionRegistered(EmbeddedCassandra.LOCALHOST,EmbeddedCassandra.PORT),is(true));
    }
  }
;
  Statement decotedStatement=cassandraRule.apply(noStatement,Description.EMPTY);
  decotedStatement.evaluate();
  verify(embeddedCassandraServerHelper).startEmbeddedCassandra("String_Node_Str","String_Node_Str");
  verify(embeddedCassandraServerHelper).stopEmbeddedCassandra();
  assertThat(ConnectionManagement.getInstance().isConnectionRegistered(EmbeddedCassandra.LOCALHOST,EmbeddedCassandra.PORT),is(false));
}

Fixed version (ground truth):
@Test public void embedded_cassandra_should_be_registered_and_started_with_custom_parameters() throws Throwable {
  EmbeddedCassandra cassandraRule=newEmbeddedCassandraRule().targetPath("String_Node_Str").cassandraConfigurationPath("String_Node_Str").build();
  cassandraRule.setEmbeddedCassandraServerHelper(embeddedCassandraServerHelper);
  Statement noStatement=new Statement(){
    @Override public void evaluate() throws Throwable {
      assertThat(ConnectionManagement.getInstance().isConnectionRegistered(EmbeddedCassandra.LOCALHOST,EmbeddedCassandra.DEFAULT_PORT),is(true));
    }
  }
;
  Statement decotedStatement=cassandraRule.apply(noStatement,Description.EMPTY);
  decotedStatement.evaluate();
  verify(embeddedCassandraServerHelper).startEmbeddedCassandra("String_Node_Str","String_Node_Str");
  verify(embeddedCassandraServerHelper).stopEmbeddedCassandra();
  assertThat(ConnectionManagement.getInstance().isConnectionRegistered(EmbeddedCassandra.LOCALHOST,EmbeddedCassandra.DEFAULT_PORT),is(false));
}
Program: 186157
Project: 186157
Buggy source:
@Test public void embedded_cassandra_should_be_registered_and_started_with_default_parameters() throws Throwable {
  EmbeddedCassandra cassandraRule=newEmbeddedCassandraRule().build();
  cassandraRule.setEmbeddedCassandraServerHelper(embeddedCassandraServerHelper);
  Statement noStatement=new Statement(){
    @Override public void evaluate() throws Throwable {
      assertThat(ConnectionManagement.getInstance().isConnectionRegistered(EmbeddedCassandra.LOCALHOST,EmbeddedCassandra.PORT),is(true));
    }
  }
;
  Statement decotedStatement=cassandraRule.apply(noStatement,Description.EMPTY);
  decotedStatement.evaluate();
  verify(embeddedCassandraServerHelper).startEmbeddedCassandra(EmbeddedCassandra.DEFAULT_CASSANDRA_CONFIGURATION_FILE_LOCATION,EmbeddedCassandra.DEFAULT_CASSANDRA_TARGET_PATH);
  verify(embeddedCassandraServerHelper).stopEmbeddedCassandra();
  assertThat(ConnectionManagement.getInstance().isConnectionRegistered(EmbeddedCassandra.LOCALHOST,EmbeddedCassandra.PORT),is(false));
}

Fixed version (ground truth):
@Test public void embedded_cassandra_should_be_registered_and_started_with_default_parameters() throws Throwable {
  EmbeddedCassandra cassandraRule=newEmbeddedCassandraRule().build();
  cassandraRule.setEmbeddedCassandraServerHelper(embeddedCassandraServerHelper);
  Statement noStatement=new Statement(){
    @Override public void evaluate() throws Throwable {
      assertThat(ConnectionManagement.getInstance().isConnectionRegistered(EmbeddedCassandra.LOCALHOST,EmbeddedCassandra.DEFAULT_PORT),is(true));
    }
  }
;
  Statement decotedStatement=cassandraRule.apply(noStatement,Description.EMPTY);
  decotedStatement.evaluate();
  verify(embeddedCassandraServerHelper).startEmbeddedCassandra(EmbeddedCassandra.DEFAULT_CASSANDRA_CONFIGURATION_FILE_LOCATION,EmbeddedCassandra.DEFAULT_CASSANDRA_TARGET_PATH);
  verify(embeddedCassandraServerHelper).stopEmbeddedCassandra();
  assertThat(ConnectionManagement.getInstance().isConnectionRegistered(EmbeddedCassandra.LOCALHOST,EmbeddedCassandra.DEFAULT_PORT),is(false));
}
Program: 186159
Project: 186159
Buggy source:
@Override public void evaluate() throws Throwable {
  assertThat(ConnectionManagement.getInstance().isConnectionRegistered(EmbeddedCassandra.LOCALHOST,EmbeddedCassandra.PORT),is(true));
}

Fixed version (ground truth):
@Override public void evaluate() throws Throwable {
  assertThat(ConnectionManagement.getInstance().isConnectionRegistered(EmbeddedCassandra.LOCALHOST,EmbeddedCassandra.DEFAULT_PORT),is(true));
}
Program: 186160
Project: 186160
Buggy source:
private void dropKeyspaces(){
  Cluster cluster=HFactory.getOrCreateCluster(this.cassandraConfiguration.getClusterName(),new CassandraHostConfigurator(getFullHost()));
  List<KeyspaceDefinition> keyspaces=cluster.describeKeyspaces();
  for (  KeyspaceDefinition keyspaceDefinition : keyspaces) {
    String keyspaceName=keyspaceDefinition.getName();
    if (!INTERNAL_CASSANDRA_KEYSPACE.equals(keyspaceName)) {
      cluster.dropKeyspace(keyspaceName);
    }
  }
}

Fixed version (ground truth):
private void dropKeyspaces(){
  List<KeyspaceDefinition> keyspaces=cluster.describeKeyspaces();
  for (  KeyspaceDefinition keyspaceDefinition : keyspaces) {
    String keyspaceName=keyspaceDefinition.getName();
    if (!INTERNAL_CASSANDRA_KEYSPACE.equals(keyspaceName)) {
      cluster.dropKeyspace(keyspaceName);
    }
  }
  List<KeyspaceDefinition> keyspaces2=cluster.describeKeyspaces();
}
Program: 186161
Project: 186161
Buggy source:
@Override public void insert(InputStream dataScript){
  InputStreamJsonDataSet dataSet=new InputStreamJsonDataSet(dataScript);
  DataLoader dataLoader=new DataLoader(cassandraConfiguration.getClusterName(),getFullHost());
  dataLoader.load(dataSet);
  cluster=HFactory.getOrCreateCluster(cassandraConfiguration.getClusterName(),getFullHost());
  keyspace=HFactory.createKeyspace(dataSet.getKeyspace().getName(),cluster);
}

Fixed version (ground truth):
@Override public void insert(InputStream dataScript){
  InputStreamJsonDataSet dataSet=new InputStreamJsonDataSet(dataScript);
  DataLoader dataLoader=new DataLoader(cassandraConfiguration.getClusterName(),getFullHost());
  dataLoader.load(dataSet);
  keyspace=HFactory.createKeyspace(dataSet.getKeyspace().getName(),cluster);
}
Program: 186162
Project: 186162
Buggy source:
public CassandraOperation(CassandraConfiguration cassandraConfiguration){
  this.cassandraConfiguration=cassandraConfiguration;
}

Fixed version (ground truth):
public CassandraOperation(CassandraConfiguration cassandraConfiguration){
  this.cassandraConfiguration=cassandraConfiguration;
  cluster=HFactory.getOrCreateCluster(cassandraConfiguration.getClusterName(),getFullHost());
}
Program: 186163
Project: 186163
Buggy source:
@Override protected void doStop(){
  stopCassandra();
}

Fixed version (ground truth):
@Override protected void doStop(){
  try {
    stopCassandra();
  }
  finally {
    ensureTargetPathDoesNotExitsAndReturnCompositePath();
  }
}