1 package com.tonbeller.jpivot.olap.model; 2 3 import com.tonbeller.jpivot.olap.model.Cell; 4 import com.tonbeller.jpivot.olap.model.Member; 5 import com.tonbeller.jpivot.olap.model.Position; 6 import com.tonbeller.jpivot.olap.model.Result; 7 8 11 public class JunitUtil { 12 13 14 17 static public void assertPosition(Result result, int iAxis, int iPos, String [] members, 18 String [] formattedValues) { 19 Position pos = (Position) result.getAxes()[iAxis].getPositions().get(iPos); 20 int nPos0 = result.getAxes()[0].getPositions().size(); 21 for (int i = 0; i < pos.getMembers().length; i++) { 22 Member m = pos.getMembers()[i]; 23 String s = m.getLabel(); 24 junit.framework.Assert.assertEquals(s, members[i]); 25 } 26 27 int nCell = iPos * nPos0; 29 for (int i = 0; i < formattedValues.length; i++) { 30 Cell cell = (Cell) result.getCells().get(nCell + i); 31 String cellval = cell.getFormattedValue().replaceAll("[^0-9]", ""); 33 String fval = formattedValues[i].replaceAll("[^0-9]", ""); 34 junit.framework.Assert.assertEquals(cellval, fval); 35 } 36 } 37 38 } 39 | Popular Tags |