}
@Test
public void testGetBytes() {
Tuple t1 = new Tuple();
String[] values = {"a","b","cdefgh","2342432","Adasdfee324324D"};
for(String val : values) {
t1.addAttribute(val);
}
String exp1 = "";
for(int i=0;i<values.length;i++) {
exp1 += values[i]+"|";
}
byte[] ret1 = t1.getBytes();
for(int i=0;i<exp1.getBytes().length;i++) {
Assert.assertTrue(ret1[i] == exp1.getBytes()[i]);
}
Assert.assertTrue(ret1[exp1.getBytes().length+1] == 0);
String tupleStr = "attr1|attr2|3|4|attr5|";
int[] offsets = {0,6,12,14,16,22};
Tuple t2 = new Tuple(tupleStr.getBytes(),offsets,5);
byte[] ret2 = t2.getBytes();
Assert.assertTrue(ret2.length == tupleStr.getBytes().length);
for(int i=0;i<tupleStr.getBytes().length;i++) {
Assert.assertTrue(ret2[i] == tupleStr.getBytes()[i]);
}