@Test
 public void testInvalidObjs() {
   for (Triplet<HBRecord, String, Class<? extends IllegalArgumentException>> p :
       TestObjects.invalidObjs) {
     HBRecord record = p.getValue0();
     String errorMessage =
         "An object with " + p.getValue1() + " should've thrown an " + p.getValue2().getName();
     try {
       hbMapper.writeValueAsResult(record);
       fail(errorMessage + " while converting bean to Result\nFailing object = " + record);
     } catch (IllegalArgumentException ex) {
       assertEquals("Mismatch in type of exception thrown", p.getValue2(), ex.getClass());
     }
     try {
       hbMapper.writeValueAsPut(record);
       fail(errorMessage + " while converting bean to Put\nFailing object = " + record);
     } catch (IllegalArgumentException ex) {
       assertEquals("Mismatch in type of exception thrown", p.getValue2(), ex.getClass());
     }
   }
 }
 @Test
 public void testInvalidClasses() {
   Set<String> exceptionMessages = new HashSet<String>();
   for (Triplet<HBRecord, String, Class<? extends IllegalArgumentException>> p :
       invalidRecordsAndErrorMessages) {
     HBRecord record = p.getValue0();
     Class recordClass = record.getClass();
     assertFalse(
         "Object mapper couldn't detect invalidity of class " + recordClass.getName(),
         hbMapper.isValid(recordClass));
     String errorMessage =
         p.getValue1()
             + " ("
             + recordClass.getName()
             + ") should have thrown an "
             + IllegalArgumentException.class.getName();
     String exMsgObjToResult = null,
         exMsgObjToPut = null,
         exMsgResultToObj = null,
         exMsgPutToObj = null;
     try {
       hbMapper.writeValueAsResult(record);
       fail(errorMessage + " while converting bean to Result");
     } catch (IllegalArgumentException ex) {
       assertEquals(
           "Mismatch in type of exception thrown for " + recordClass.getSimpleName(),
           p.getValue2(),
           ex.getClass());
       exMsgObjToResult = ex.getMessage();
     }
     try {
       hbMapper.writeValueAsPut(record);
       fail(errorMessage + " while converting bean to Put");
     } catch (IllegalArgumentException ex) {
       assertEquals(
           "Mismatch in type of exception thrown for " + recordClass.getSimpleName(),
           p.getValue2(),
           ex.getClass());
       exMsgObjToPut = ex.getMessage();
     }
     try {
       hbMapper.readValue(someResult, recordClass);
       fail(errorMessage + " while converting Result to bean");
     } catch (IllegalArgumentException ex) {
       assertEquals(
           "Mismatch in type of exception thrown for " + recordClass.getSimpleName(),
           p.getValue2(),
           ex.getClass());
       exMsgResultToObj = ex.getMessage();
     }
     try {
       hbMapper.readValue(
           new ImmutableBytesWritable(someResult.getRow()), someResult, recordClass);
       fail(errorMessage + " while converting Result to bean");
     } catch (IllegalArgumentException ex) {
       assertEquals(
           "Mismatch in type of exception thrown for " + recordClass.getSimpleName(),
           p.getValue2(),
           ex.getClass());
     }
     try {
       hbMapper.readValue(somePut, recordClass);
       fail(errorMessage + " while converting Put to bean");
     } catch (IllegalArgumentException ex) {
       assertEquals(
           "Mismatch in type of exception thrown for " + recordClass.getSimpleName(),
           p.getValue2(),
           ex.getClass());
       exMsgPutToObj = ex.getMessage();
     }
     try {
       hbMapper.readValue(new ImmutableBytesWritable(somePut.getRow()), somePut, recordClass);
       fail(errorMessage + " while converting row key and Put combo to bean");
     } catch (IllegalArgumentException ex) {
       assertEquals("Mismatch in type of exception thrown", p.getValue2(), ex.getClass());
     }
     assertEquals(
         "Validation for 'conversion to Result' and 'conversion to Put' differ in code path",
         exMsgObjToResult,
         exMsgObjToPut);
     assertEquals(
         "Validation for 'conversion from Result' and 'conversion from Put' differ in code path",
         exMsgResultToObj,
         exMsgPutToObj);
     assertEquals(
         "Validation for 'conversion from bean' and 'conversion to bean' differ in code path",
         exMsgObjToResult,
         exMsgResultToObj);
     System.out.printf(
         "%s threw below Exception as expected:\n%s\n%n", p.getValue1(), exMsgObjToResult);
     if (!exceptionMessages.add(exMsgObjToPut)) {
       fail("Same error message for different invalid inputs");
     }
   }
 }