SIntListofTuples { public SIntListofTuples add(List<DRes<SInt>> row, DRes<SInt> falseValue) { if (row.size() != rowWidth) { throw new RuntimeException("Row width wrong. Should be " + rowWidth); } theData.add(row); duplicateP.add(falseValue); return this; } SIntListofTuples(int rowWidth); SIntListofTuples add(List<DRes<SInt>> row, DRes<SInt> falseValue); DRes<SInt> getId(int index); void setDuplicate(int index, DRes<SInt> value); DRes<SInt> getDuplicate(int index); int size(); final int rowWidth; }
@Test (expected=RuntimeException.class) public void testLengthCheck() { SIntListofTuples list = new SIntListofTuples(2); list.add(new ArrayList<DRes<SInt>>(), null); Assert.fail("Should not be reachable."); }