public static String encodeBase64Zipped( byte[] src ) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream( 1024 );
    try ( Base64OutputStream base64OutputStream = new Base64OutputStream( baos );
          GZIPOutputStream gzos = new GZIPOutputStream( base64OutputStream ) ) {
      gzos.write( src );
    }
    return baos.toString();
  }
@Test
  public void testEncodeBase64Zipped() throws Exception {
    TestClass testClass = new TestClass();
    testClass.setTestProp1( "testPropValue1" );
    testClass.setTestProp2( "testPropValue2" );

    String base64ZippedString = this.encode( testClass );

    Assert.assertNotNull( base64ZippedString );
    Assert.assertTrue( !base64ZippedString.trim().isEmpty() );
  }