Program: 16590
Project: 16590
Buggy source:
@Test public void testAFPconversion() throws Exception {
  AFPChain afp=new AFPChain("String_Node_Str");
  afp.setName1("String_Node_Str");
  afp.setName2("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.getMultipleAlignment(0);
  assertEquals(afp.getName1(),ensemble.getStructureIdentifiers().get(0));
  assertEquals(afp.getName2(),ensemble.getStructureIdentifiers().get(1));
  assertEquals(afp.getAlgorithmName(),ensemble.getAlgorithmName());
  assertEquals(afp.getVersion(),ensemble.getVersion());
  assertTrue(ensemble.getCalculationTime().equals(afp.getCalculationTime()));
  assertEquals(afp.getBlockNum(),msa.getBlockSets().size());
  for (int b=0; b < afp.getBlockNum(); b++) {
    assertEquals(Calc.getTransformation(afp.getBlockRotationMatrix()[b],afp.getBlockShiftVector()[b]),msa.getBlockSet(b).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.getBlock(b).getAlignRes().get(c).get(res));
      }
    }
  }
}

Fixed version (ground truth):
@Test public void testAFPconversion() throws Exception {
  AFPChain afp=new AFPChain("String_Node_Str");
  afp.setName1("String_Node_Str");
  afp.setName2("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.getMultipleAlignment(0);
  assertEquals(afp.getName1(),ensemble.getStructureIdentifiers().get(0).getIdentifier());
  assertEquals(afp.getName2(),ensemble.getStructureIdentifiers().get(1).getIdentifier());
  assertEquals(afp.getAlgorithmName(),ensemble.getAlgorithmName());
  assertEquals(afp.getVersion(),ensemble.getVersion());
  assertTrue(ensemble.getCalculationTime().equals(afp.getCalculationTime()));
  assertEquals(afp.getBlockNum(),msa.getBlockSets().size());
  for (int b=0; b < afp.getBlockNum(); b++) {
    assertEquals(Calc.getTransformation(afp.getBlockRotationMatrix()[b],afp.getBlockShiftVector()[b]),msa.getBlockSet(b).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.getBlock(b).getAlignRes().get(c).get(res));
      }
    }
  }
}