Program: 4488
Project: 4488
Buggy source:
@Test public void testBasicSetupEncoder_AUTO_MODE(){
  Sensor<File> sensor=Sensor.create(FileSensor::create,SensorParams.create(Keys::path,"String_Node_Str",ResourceLocator.path("String_Node_Str")));
  Parameters p=NetworkTestHarness.getParameters();
  p=p.union(NetworkTestHarness.getHotGymTestEncoderParams());
  p.setParameterByKey(KEY.RANDOM,new MersenneTwister(42));
  p.setParameterByKey(KEY.AUTO_CLASSIFY,Boolean.TRUE);
  HTMSensor<File> htmSensor=(HTMSensor<File>)sensor;
  Network n=Network.create("String_Node_Str",p);
  Layer<int[]> l=new Layer<>(n);
  l.add(htmSensor);
  int[][] expected=new int[][]{{0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1},{0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},{0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0}};
  l.start();
  l.subscribe(new Observer<Inference>(){
    int seq=0;
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      e.printStackTrace();
    }
    @Override public void onNext(    Inference output){
      assertTrue(Arrays.equals(expected[seq++],output.getSDR()));
    }
  }
);
  l.subscribe(new Observer<Inference>(){
    int seq=0;
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      e.printStackTrace();
    }
    @Override public void onNext(    Inference output){
      assertTrue(Arrays.equals(expected[seq++],output.getSDR()));
    }
  }
);
  try {
    l.getLayerThread().join();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Test public void testBasicSetupEncoder_AUTO_MODE(){
  Sensor<File> sensor=Sensor.create(FileSensor::create,SensorParams.create(Keys::path,"String_Node_Str",ResourceLocator.path("String_Node_Str")));
  Parameters p=NetworkTestHarness.getParameters();
  p=p.union(NetworkTestHarness.getHotGymTestEncoderParams());
  p.setParameterByKey(KEY.RANDOM,new MersenneTwister(42));
  p.setParameterByKey(KEY.AUTO_CLASSIFY,Boolean.TRUE);
  HTMSensor<File> htmSensor=(HTMSensor<File>)sensor;
  Network n=Network.create("String_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0,0,0,0},{0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0}};
  l.start();
  l.subscribe(new Observer<Inference>(){
    int seq=0;
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      e.printStackTrace();
    }
    @Override public void onNext(    Inference output){
      System.out.println("String_Node_Str" + seq + "String_Node_Str"+ Arrays.toString(expected[seq]));
      System.out.println("String_Node_Str" + seq + "String_Node_Str"+ Arrays.toString(output.getSDR()));
      assertTrue(Arrays.equals(expected[seq++],output.getSDR()));
    }
  }
);
  l.subscribe(new Observer<Inference>(){
    int seq2=0;
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      e.printStackTrace();
    }
    @Override public void onNext(    Inference output){
      System.out.println("String_Node_Str" + seq2 + "String_Node_Str"+ Arrays.toString(expected[seq2]));
      System.out.println("String_Node_Str" + seq2 + "String_Node_Str"+ Arrays.toString(output.getSDR()));
      assertTrue(Arrays.equals(expected[seq2++],output.getSDR()));
    }
  }
);
  try {
    l.getLayerThread().join();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}