public static Message toProto(final Map<?, ?> inputData, final Message defaultInstance) {
        ObjectHelper.notNull(inputData, "inputData");
        ObjectHelper.notNull(defaultInstance, "defaultInstance");

        final Descriptor descriptor = defaultInstance.getDescriptorForType();
        final Builder target = defaultInstance.newBuilderForType();

        return convertMapToMessage(descriptor, target, inputData);
    }
@Test
    public void testIfCorrectlyParseMap() {
        final Map<String, Object> phoneNumber = new HashMap<>();
        phoneNumber.put("number", "011122233");
        phoneNumber.put("type", "MOBILE");

        final Map<String, Object> phoneNumber2 = new HashMap<>();
        phoneNumber2.put("number", "5542454");
        phoneNumber2.put("type", 2);

        final Map<String, Object> address = new HashMap<>();
        address.put("street", "awesome street");
        address.put("street_number", 12);
        address.put("is_valid", false);

        final Map<String, Object> input = new HashMap<>();

        input.put("name", "Martin");
        input.put("id", 1234);
        input.put("phone", Arrays.asList(phoneNumber, phoneNumber2));
        input.put("email", "some@some.com");
        input.put("nicknames", Arrays.asList("awesome1", "awesome2"));
        input.put("address", address);

        final AddressBookProtos.Person message
                = (AddressBookProtos.Person) ProtobufConverter.toProto(input, AddressBookProtos.Person.getDefaultInstance());

        // assert primitives types and strings
        assertEquals("Martin", message.getName());
        assertEquals(1234, message.getId());
        assertEquals("some@some.com", message.getEmail());

        // assert nested message
        assertEquals("awesome street", message.getAddress().getStreet());
        assertEquals(12, message.getAddress().getStreetNumber());
        assertFalse(message.getAddress().getIsValid());

        // assert repeated messages
        assertEquals("011122233", message.getPhone(0).getNumber());
        assertEquals("MOBILE", message.getPhone(0).getType().name());
        assertEquals("5542454", message.getPhone(1).getNumber());
        assertEquals("WORK", message.getPhone(1).getType().name());

        assertEquals("awesome1", message.getNicknames(0));
        assertEquals("awesome2", message.getNicknames(1));
    }