Program: 4490
Project: 4490
Buggy source:
@Test public void testGetAllPredictions(){
  final int PRIME_COUNT=35;
  final int NUM_CYCLES=199;
  final int INPUT_GROUP_COUNT=7;
  TOTAL=0;
  Parameters p=NetworkTestHarness.getParameters();
  p=p.union(NetworkTestHarness.getDayDemoTestEncoderParams());
  p.setParameterByKey(KEY.RANDOM,new MersenneTwister(42));
  p.setParameterByKey(KEY.SP_PRIMER_DELAY,PRIME_COUNT);
  MultiEncoder me=MultiEncoder.builder().name("String_Node_Str").build();
  final Layer<Map<String,Object>> l=new Layer<>(p,me,new SpatialPooler(),new TemporalMemory(),Boolean.TRUE,null);
  l.subscribe(new Observer<Inference>(){
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      System.out.println("String_Node_Str" + e.getMessage());
      e.printStackTrace();
    }
    @Override public void onNext(    Inference i){
      assertNotNull(i);
      TOTAL++;
    }
  }
);
  Map<String,Object> multiInput=new HashMap<>();
  for (int i=0; i < NUM_CYCLES; i++) {
    for (double j=0; j < INPUT_GROUP_COUNT; j++) {
      multiInput.put("String_Node_Str",j);
      l.compute(multiInput);
    }
  }
  assertEquals((NUM_CYCLES * INPUT_GROUP_COUNT) - PRIME_COUNT,TOTAL);
  double[] all=l.getAllPredictions("String_Node_Str",1);
  double highestVal=Double.NEGATIVE_INFINITY;
  int highestIdx=-1;
  int i=0;
  for (  double d : all) {
    if (d > highestVal) {
      highestIdx=i;
      highestVal=d;
    }
    i++;
  }
  assertEquals(highestIdx,l.getMostProbableBucketIndex("String_Node_Str",1));
  assertEquals(7,l.getAllPredictions("String_Node_Str",1).length);
  assertTrue(Arrays.equals(ArrayUtils.where(l.getActiveColumns(),ArrayUtils.WHERE_1),l.getPreviousPredictedColumns()));
}

Fixed version (ground truth):
@Test public void testGetAllPredictions(){
  final int PRIME_COUNT=35;
  final int NUM_CYCLES=99;
  final int INPUT_GROUP_COUNT=7;
  TOTAL=0;
  Parameters p=NetworkTestHarness.getParameters();
  p=p.union(NetworkTestHarness.getDayDemoTestEncoderParams());
  p.setParameterByKey(KEY.RANDOM,new MersenneTwister(42));
  p.setParameterByKey(KEY.SP_PRIMER_DELAY,PRIME_COUNT);
  MultiEncoder me=MultiEncoder.builder().name("String_Node_Str").build();
  final Layer<Map<String,Object>> l=new Layer<>(p,me,new SpatialPooler(),new TemporalMemory(),Boolean.TRUE,null);
  l.subscribe(new Observer<Inference>(){
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      System.out.println("String_Node_Str" + e.getMessage());
      e.printStackTrace();
    }
    @Override public void onNext(    Inference i){
      assertNotNull(i);
      TOTAL++;
    }
  }
);
  Map<String,Object> multiInput=new HashMap<>();
  for (int i=0; i < NUM_CYCLES; i++) {
    for (double j=0; j < INPUT_GROUP_COUNT; j++) {
      multiInput.put("String_Node_Str",j);
      l.compute(multiInput);
    }
    l.reset();
  }
  assertEquals((NUM_CYCLES * INPUT_GROUP_COUNT) - PRIME_COUNT,TOTAL);
  double[] all=l.getAllPredictions("String_Node_Str",1);
  double highestVal=Double.NEGATIVE_INFINITY;
  int highestIdx=-1;
  int i=0;
  for (  double d : all) {
    if (d > highestVal) {
      highestIdx=i;
      highestVal=d;
    }
    i++;
  }
  assertEquals(highestIdx,l.getMostProbableBucketIndex("String_Node_Str",1));
  assertEquals(7,l.getAllPredictions("String_Node_Str",1).length);
  assertTrue(Arrays.equals(ArrayUtils.where(l.getActiveColumns(),ArrayUtils.WHERE_1),l.getPreviousPredictedColumns()));
}