### Question:
BasicPbCodec { public static byte[] encodeString(String data){ if(data == null){ return null; } BaseProto.BaseString.Builder builder = BaseProto.BaseString.newBuilder(); builder.setStringData(data); return builder.build().toByteArray(); }  static byte[] encodeBytesList(byte[]... elements); static byte[] encodeBytesList(List<ByteArrayWrapper> bytesList); static List<ByteArrayWrapper> decodeBytesList(byte[] protoBuf); static byte[] encodeInt(int data); static int decodeInt(byte[] protoBuf); static byte[] encodeLong(long data); static long decodeLong(byte[] protoBuf); static byte[] encodeString(String data); static String decodeString(byte[] protoBuf);  }### Answer:
@Test public void encodeString() throws InvalidProtocolBufferException { byte[] result = BasicPbCodec.encodeString(stringData); String stringResult = BasicPbCodec.decodeString(result); Assert.assertEquals(stringData,stringResult); }