package org.yogurt.protobufftools;

import org.junit.Test;
import org.yogurt.protobufftools.ReflectiveEncoder;
import org.yogurt.testClasses.Person;

import static org.junit.Assert.assertEquals;

public class ReflectiveEncoderTest {

    @Test
    public void testEncodeAndDecode() throws Exception {
        Person person = new Person();

        person.setTheEmail("fake@theEmail.com");
        person.setName("James");

        ReflectiveEncoder encoder = new ReflectiveEncoder();

        byte[] bytes = encoder.encode(person);
        Object actual = encoder.decode(bytes);

        assertEquals(person, actual);
    }

}

@@ -74,80 +74,71 @@
 urt.
-protobufftools.ReflectiveEncoder;%0Aimport org.yogurt.testClasses.Person;%0A
+testClasses.Person;%0A%0Aimport static org.junit.Assert.assertNull;
 %0Aimp
@@ -405,16 +405,63 @@
 James%22);
+%0A        person.setDontSentMe(%22dont send me!%22);
 %0A%0A      
@@ -648,16 +648,72 @@
 actual);
+%0A%0A        assertNull(((Person) actual).getDontSentMe());
 %0A    %7D%0A%0A

make sure non annotated fields are not being sent