### Question:
ProtobufUtil { public static byte[] toWrappedByteArray(ImmutableSerializationContext ctx, Object t) throws IOException { return toWrappedByteArray(ctx, t, BUFFER_SIZE); } private  ProtobufUtil(); static SerializationContext newSerializationContext(); static SerializationContext newSerializationContext(Configuration configuration); static void writeTo(ImmutableSerializationContext ctx, OutputStream out, Object t); static byte[] toByteArray(ImmutableSerializationContext ctx, Object t); static ByteBuffer toByteBuffer(ImmutableSerializationContext ctx, Object t); static A readFrom(ImmutableSerializationContext ctx, InputStream in, Class<A> clazz); static A fromByteArray(ImmutableSerializationContext ctx, byte[] bytes, Class<A> clazz); static A fromByteArray(ImmutableSerializationContext ctx, byte[] bytes, int offset, int length, Class<A> clazz); static A fromByteBuffer(ImmutableSerializationContext ctx, ByteBuffer byteBuffer, Class<A> clazz); static A fromWrappedByteArray(ImmutableSerializationContext ctx, byte[] bytes); static A fromWrappedByteArray(ImmutableSerializationContext ctx, byte[] bytes, int offset, int length); static A fromWrappedByteBuffer(ImmutableSerializationContext ctx, ByteBuffer byteBuffer); static A fromWrappedStream(ImmutableSerializationContext ctx, InputStream in); static byte[] toWrappedByteArray(ImmutableSerializationContext ctx, Object t); static byte[] toWrappedByteArray(ImmutableSerializationContext ctx, Object t, int bufferSize); static ByteBuffer toWrappedByteBuffer(ImmutableSerializationContext ctx, Object t); static void toWrappedStream(ImmutableSerializationContext ctx, OutputStream out, Object t); static void toWrappedStream(ImmutableSerializationContext ctx, OutputStream out, Object t, int bufferSize); static String toCanonicalJSON(ImmutableSerializationContext ctx, byte[] bytes); static byte[] fromCanonicalJSON(ImmutableSerializationContext ctx, Reader reader); static String toCanonicalJSON(ImmutableSerializationContext ctx, byte[] bytes, boolean prettyPrint);  }### Answer:
@Test public void testWrappedMessageTypeIdMapper() throws Exception { WrappedMessageTypeIdMapper mapper = new WrappedMessageTypeIdMapper() { @Override public int mapTypeIdOut(int typeId, ImmutableSerializationContext ctx) { if (typeId == 100042) { return 100021; } return typeId; } }; Configuration cfg = Configuration.builder() .wrappingConfig() .wrappedMessageTypeIdMapper(mapper) .build(); ImmutableSerializationContext ctx = createContext(cfg); User user = new User(); user.setId(1); user.setName("John"); user.setSurname("Batman"); user.setGender(User.Gender.MALE); byte[] bytes = ProtobufUtil.toWrappedByteArray(ctx, user); int[] seenTypeId = new int[] { -1 }; TagHandler tagHandler = new TagHandler() { @Override public void onTag(int fieldNumber, FieldDescriptor fieldDescriptor, Object tagValue) { if (fieldNumber == WrappedMessage.WRAPPED_DESCRIPTOR_TYPE_ID) { seenTypeId[0] = (Integer) tagValue; } } }; Descriptor wrappedMessageDescriptor = ctx.getMessageDescriptor(WrappedMessage.PROTOBUF_TYPE_NAME); ProtobufParser.INSTANCE.parse(tagHandler, wrappedMessageDescriptor, bytes); assertEquals(100021, seenTypeId[0]); }