Code example for Excluder

Methods: excludeFieldsWithoutExposeAnnotation

0
 * Unit tests for GsonBuilder.REQUIRE_EXPOSE_DESERIALIZE. 
 * 
 * @author Joel Leitch 
 */ 
public class ExposeAnnotationExclusionStrategyTest extends TestCase {
  private Excluder excluder = Excluder.DEFAULT.excludeFieldsWithoutExposeAnnotation();
 
  public void testNeverSkipClasses() throws Exception { 
    assertFalse(excluder.excludeClass(MockObject.class, true));
    assertFalse(excluder.excludeClass(MockObject.class, false));
  } 
 
  public void testSkipNonAnnotatedFields() throws Exception { 
    Field f = createFieldAttributes("hiddenField");
    assertTrue(excluder.excludeField(f, true));
    assertTrue(excluder.excludeField(f, false));
  } 
 
  public void testSkipExplicitlySkippedFields() throws Exception { 
    Field f = createFieldAttributes("explicitlyHiddenField");