Program: 16652
Project: 16652
Buggy source:
@Test public void testAFPconversion() throws Exception {
  AFPChain afp=new AFPChain();
  afp.setName1("String_Node_Str");
  afp.setName2("String_Node_Str");
  afp.setAlgorithmName("String_Node_Str");
  afp.setVersion("String_Node_Str");
  afp.setCalculationTime(System.currentTimeMillis());
  int[][][] optAln=new int[3][][];
  for (int b=0; b < optAln.length; b++) {
    int[][] block=new int[2][];
    for (int c=0; c < block.length; c++) {
      int[] residues={b + 5,b + 6,b + 7,b + 8,b + 9};
      block[c]=residues;
    }
    optAln[b]=block;
  }
  afp.setOptAln(optAln);
  afp.setBlockNum(optAln.length);
  Matrix rot=Matrix.identity(3,3);
  Atom shift=new AtomImpl();
  shift.setX(0);
  shift.setY(0);
  shift.setZ(0);
  Matrix[] blockRot={rot,rot,rot};
  afp.setBlockRotationMatrix(blockRot);
  Atom[] blockShift={shift,shift,shift};
  afp.setBlockShiftVector(blockShift);
  MultipleAlignmentEnsemble ensemble=new MultipleAlignmentEnsembleImpl(afp,null,null,true);
  MultipleAlignment msa=ensemble.getMultipleAlignments().get(0);
  assertEquals(afp.getName1(),ensemble.getStructureNames().get(0));
  assertEquals(afp.getName2(),ensemble.getStructureNames().get(1));
  assertEquals(afp.getAlgorithmName(),ensemble.getAlgorithmName());
  assertEquals(afp.getVersion(),ensemble.getVersion());
  assertTrue(ensemble.getCalculationTime().equals(afp.getCalculationTime()));
  assertEquals(afp.getBlockNum(),msa.getBlockSets().size());
  assertEquals(Calc.getTransformation(afp.getBlockRotationMatrix()[0],afp.getBlockShiftVector()[0]),msa.getTransformations().get(1));
  assertEquals(msa.getScore(MultipleAlignmentScorer.CE_SCORE),(Double)afp.getAlignScore());
  assertEquals(msa.getScore(MultipleAlignmentScorer.AVGTM_SCORE),(Double)afp.getTMScore());
  assertEquals(msa.getScore(MultipleAlignmentScorer.RMSD),(Double)afp.getTotalRmsdOpt());
  for (int b=0; b < 3; b++) {
    for (int c=0; c < 2; c++) {
      for (int res=0; res < 5; res++) {
        Integer afpRes=afp.getOptAln()[b][c][res];
        assertEquals(afpRes,msa.getBlocks().get(b).getAlignRes().get(c).get(res));
      }
    }
  }
}

Fixed version (ground truth):
@Test public void testAFPconversion() throws Exception {
  AFPChain afp=new AFPChain();
  afp.setName1("String_Node_Str");
  afp.setName2("String_Node_Str");
  afp.setAlgorithmName("String_Node_Str");
  afp.setVersion("String_Node_Str");
  afp.setCalculationTime(System.currentTimeMillis());
  int[][][] optAln=new int[3][][];
  for (int b=0; b < optAln.length; b++) {
    int[][] block=new int[2][];
    for (int c=0; c < block.length; c++) {
      int[] residues={b + 5,b + 6,b + 7,b + 8,b + 9};
      block[c]=residues;
    }
    optAln[b]=block;
  }
  afp.setOptAln(optAln);
  afp.setBlockNum(optAln.length);
  double[][] mat={{0.13,1.5,0.84},{1.3,0.44,2.3},{1.0,1.2,2.03}};
  Matrix rot=new Matrix(mat);
  Atom shift=new AtomImpl();
  shift.setX(0.44);
  shift.setY(0.21);
  shift.setZ(0.89);
  Matrix[] blockRot={rot,rot,rot};
  afp.setBlockRotationMatrix(blockRot);
  Atom[] blockShift={shift,shift,shift};
  afp.setBlockShiftVector(blockShift);
  MultipleAlignmentEnsemble ensemble=new MultipleAlignmentEnsembleImpl(afp,null,null,true);
  MultipleAlignment msa=ensemble.getMultipleAlignments().get(0);
  assertEquals(afp.getName1(),ensemble.getStructureNames().get(0));
  assertEquals(afp.getName2(),ensemble.getStructureNames().get(1));
  assertEquals(afp.getAlgorithmName(),ensemble.getAlgorithmName());
  assertEquals(afp.getVersion(),ensemble.getVersion());
  assertTrue(ensemble.getCalculationTime().equals(afp.getCalculationTime()));
  assertEquals(afp.getBlockNum(),msa.getBlockSets().size());
  assertEquals(Calc.getTransformation(afp.getBlockRotationMatrix()[0],afp.getBlockShiftVector()[0]),msa.getTransformations().get(1));
  assertEquals(msa.getScore(MultipleAlignmentScorer.CE_SCORE),(Double)afp.getAlignScore());
  assertEquals(msa.getScore(MultipleAlignmentScorer.AVGTM_SCORE),(Double)afp.getTMScore());
  assertEquals(msa.getScore(MultipleAlignmentScorer.RMSD),(Double)afp.getTotalRmsdOpt());
  for (int b=0; b < 3; b++) {
    for (int c=0; c < 2; c++) {
      for (int res=0; res < 5; res++) {
        Integer afpRes=afp.getOptAln()[b][c][res];
        assertEquals(afpRes,msa.getBlocks().get(b).getAlignRes().get(c).get(res));
      }
    }
  }
}