@Test
    public void testInvalidCompressionFormat() throws HiveException {
        GenericUDFDeserialize udf = new GenericUDFDeserialize();
        udf.initialize(new ObjectInspector[]{PrimitiveObjectInspectorFactory.writableStringObjectInspector,
                PrimitiveObjectInspectorFactory.writableStringObjectInspector});
        GenericUDF.DeferredObject[] args = new GenericUDF.DeferredObject[2];
        String expectedOutput = "test";
        MessageEncoder encoder = MessageFactory.getDefaultInstanceForReplMetrics(new HiveConf());
        String serializedMsg = encoder.getSerializer().serialize(expectedOutput);
        String compressionFormat = "randomSerialization";
        args[0] = new GenericUDF.DeferredJavaObject(new Text(serializedMsg));
        args[1] = new GenericUDF.DeferredJavaObject(new Text(compressionFormat));
        HiveException ex = null;
        try {
            udf.evaluate(args).toString();
        } catch (HiveException e) {
            ex = e;
        }
        assertNotNull("Invalid message format provided.", ex);
        assertTrue(ex.getMessage().contains("compressionFormat: " + compressionFormat + " is not supported."));
    }
TestGenericUDFDeserialize:
Utility to test the behaviour of GenericUDFDeserialize.
ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFDeserialize.java