Skip to content

Commit

Permalink
fix ci failure
Browse files Browse the repository at this point in the history
  • Loading branch information
zhexuany committed May 24, 2019
1 parent ec6ffab commit 44fcaa8
Showing 1 changed file with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.pingcap.tikv.types.IntegerType;
import com.pingcap.tikv.types.StringType;
import com.pingcap.tikv.types.TimestampType;
import gnu.trove.list.array.TLongArrayList;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -34,7 +33,6 @@ private static TiTableInfo createTable() {

private Object[] values;
private TiTableInfo tblInfo = createTable();
private TLongArrayList colIds;

private void makeValues() {
List<Object> values = new ArrayList<>();
Expand All @@ -48,30 +46,18 @@ private void makeValues() {
this.values = values.toArray();
}

private void makeColIds() {
TLongArrayList colIds = new TLongArrayList();
colIds.add(10L);
colIds.add(11L);
colIds.add(12L);
colIds.add(13L);
colIds.add(14L);
colIds.add(15L);
this.colIds = colIds;
}

@Before
public void setUp() {
makeColIds();
makeValues();
}

@Rule public ExpectedException expectedEx = ExpectedException.none();

@Test
public void testRowCodecThrowException() {
TLongArrayList fakeColIds = TLongArrayList.wrap(new long[] {1, 2});
try {
TableCodec.encodeRow(tblInfo.getColumns(), values, tblInfo.isPkHandle());
TableCodec.encodeRow(
tblInfo.getColumns(), new Object[] {values[0], values[1]}, tblInfo.isPkHandle());
expectedEx.expect(IllegalAccessException.class);
expectedEx.expectMessage("encodeRow error: data and columnID count not match 6 vs 2");
} catch (IllegalAccessException ignored) {
Expand All @@ -97,7 +83,7 @@ public void testRowCodec() {
// testing the correctness via decodeRow
Object[] res = TableCodec.decodeRow(new CodecDataInput(bytes), tblInfo.getColumns());
for (int j = 0; j < tblInfo.getColumns().size(); j++) {
assertEquals(res[2 * j], colIds.get(j));
assertEquals(res[2 * j], tblInfo.getColumn(j).getId());
assertEquals(res[2 * j + 1], values[j]);
}
} catch (IllegalAccessException ignored) {
Expand Down

0 comments on commit 44fcaa8

Please sign in to comment.