@Test public void testGetViolationDescription() { assertEquals( AlphaNumKeyConstraint.ROW_VIOLATION_MESSAGE, ankc.getViolationDescription(AlphaNumKeyConstraint.NON_ALPHA_NUM_ROW)); assertEquals( AlphaNumKeyConstraint.COLF_VIOLATION_MESSAGE, ankc.getViolationDescription(AlphaNumKeyConstraint.NON_ALPHA_NUM_COLF)); assertEquals( AlphaNumKeyConstraint.COLQ_VIOLATION_MESSAGE, ankc.getViolationDescription(AlphaNumKeyConstraint.NON_ALPHA_NUM_COLQ)); assertNull(ankc.getViolationDescription((short) 4)); }
@Test public void test() { Mutation goodMutation = new Mutation(new Text("Row1")); goodMutation.put(new Text("Colf2"), new Text("ColQ3"), new Value("value".getBytes())); assertNull(ankc.check(null, goodMutation)); // Check that violations are in row, cf, cq order Mutation badMutation = new Mutation(new Text("Row#1")); badMutation.put(new Text("Colf$2"), new Text("Colq%3"), new Value("value".getBytes())); assertEquals( ImmutableList.of( AlphaNumKeyConstraint.NON_ALPHA_NUM_ROW, AlphaNumKeyConstraint.NON_ALPHA_NUM_COLF, AlphaNumKeyConstraint.NON_ALPHA_NUM_COLQ), ankc.check(null, badMutation)); }