// add two columns:
DiscreteChar dnaChar = (DiscreteChar) dnaType.getDefaultCharacter();
assertTrue("Failed to load dna character", dnaChar != null);
MatrixColumn c1 = new MatrixColumn();
c1.setCharacter(dnaChar);
matrix.addColumn(c1);
MatrixColumn c2 = new MatrixColumn();
c2.setCharacter(dnaChar);
matrix.addColumn(c2);
// add two rows:
TaxonLabel taxonLabel = new TaxonLabel();
taxonLabel.setTaxonLabel(newName);
// missing symbol is ?
DiscreteCharState aState = dnaChar.getStateByDescription("" + DiscreteCharState.MISSING_SYMBOL);
assertTrue("? is not a valid state", aState != null);
// create one row with 2 elements:
MatrixRow r1 = new MatrixRow();
r1.setTaxonLabel(taxonLabel);
DiscreteMatrixElement e1 = new DiscreteMatrixElement();
e1.setColumn(c1);
e1.setCharState(aState);
r1.addElement(e1);
DiscreteMatrixElement e2 = new DiscreteMatrixElement();
e2.setColumn(c2);
e2.setCharState(aState);
r1.addElement(e2);
// add two segments, each with one element:
RowSegment seg1 = new RowSegment();
seg1.setStartIndex(0);
seg1.setEndIndex(0);
r1.addSegment(seg1);
RowSegment seg2 = new RowSegment();
seg2.setStartIndex(1);
seg2.setEndIndex(1);
r1.addSegment(seg2);
matrix.addRow(r1);
// TODO: add a second row.
//getMatrixHome().store(taxonLabel);
getMatrixHome().store(c1);
getMatrixHome().store(c2);
getMatrixHome().store(e1);
getMatrixHome().store(e2);
getMatrixHome().store(matrix);
// 2. verify
Long matrixID = matrix.getId();
Long c1ID = c1.getId();
Long c2ID = c2.getId();
Long r1ID = r1.getId();
Long seg1ID = seg1.getId();
Long seg2ID = seg2.getId();
Long e1ID = e1.getId();
Long e2ID = e2.getId();