Search in sources :

Example 6 with ManyFilteringsOnClassEntity

use of org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsOnClassEntity in project jersey by jersey.

the class JsonEntityFilteringOnClassTest method testManyFilteringsEntityManyViews.

@Test
public void testManyFilteringsEntityManyViews() throws Exception {
    final ManyFilteringsOnClassEntity entity = target("ManyFilteringsEntityManyViews").request().get(ManyFilteringsOnClassEntity.class);
    // ManyFilteringsOnClassEntity
    assertThat(entity.field, is(50));
    assertThat(entity.accessorTransient, is("propertyproperty"));
    assertThat(entity.getProperty(), is("property"));
    // FilteredClassEntity
    final FilteredClassEntity filtered = entity.filtered;
    assertThat(filtered, notNullValue());
    assertThat(filtered.field, is(0));
    assertThat(filtered.getProperty(), nullValue());
    // DefaultFilteringSubEntity
    assertThat(entity.defaultEntities, notNullValue());
    assertThat(entity.defaultEntities.size(), is(1));
    final DefaultFilteringSubEntity defaultFilteringSubEntity = entity.defaultEntities.get(0);
    assertThat(defaultFilteringSubEntity.field, is(true));
    assertThat(defaultFilteringSubEntity.getProperty(), is(20L));
    // OneFilteringSubEntity
    assertThat(entity.oneEntities, notNullValue());
    assertThat(entity.oneEntities.size(), is(1));
    final OneFilteringSubEntity oneFilteringSubEntity = entity.oneEntities.get(0);
    assertThat(oneFilteringSubEntity.field1, is(20));
    assertThat(oneFilteringSubEntity.field2, is(30));
    assertThat(oneFilteringSubEntity.getProperty1(), is("property1"));
    assertThat(oneFilteringSubEntity.getProperty2(), is("property2"));
    // ManyFilteringsSubEntity
    assertThat(entity.manyEntities, notNullValue());
    assertThat(entity.manyEntities.size(), is(1));
    final ManyFilteringsSubEntity manyFilteringsSubEntity = entity.manyEntities.get(0);
    assertThat(manyFilteringsSubEntity.field1, is(60));
    assertThat(manyFilteringsSubEntity.field2, is(70));
    assertThat(manyFilteringsSubEntity.getProperty1(), is("property1"));
    assertThat(manyFilteringsSubEntity.getProperty2(), is("property2"));
}
Also used : FilteredClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.FilteredClassEntity) DefaultFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.DefaultFilteringSubEntity) ManyFilteringsOnClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsOnClassEntity) OneFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringSubEntity) ManyFilteringsSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsSubEntity) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test)

Aggregations

ManyFilteringsOnClassEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsOnClassEntity)6 Test (org.junit.Test)6 JerseyTest (org.glassfish.jersey.test.JerseyTest)5 FilteredClassEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.FilteredClassEntity)5 DefaultFilteringSubEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.DefaultFilteringSubEntity)4 ManyFilteringsSubEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsSubEntity)4 OneFilteringSubEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringSubEntity)4 Annotation (java.lang.annotation.Annotation)2 ClientConfig (org.glassfish.jersey.client.ClientConfig)2