use of com.apollographql.apollo.integration.normalizer.HeroTypeDependentAliasedFieldQuery in project apollo-android by apollographql.
the class ResponseNormalizationTest method testHeroParentTypeDependentAliasedFieldQueryHuman.
@Test
public void testHeroParentTypeDependentAliasedFieldQueryHuman() throws Exception {
assertHasNoErrors("HeroTypeDependentAliasedFieldResponseHuman.json", new HeroTypeDependentAliasedFieldQuery(Input.fromNullable(EMPIRE)));
Record record = normalizedCache.loadRecord(QUERY_ROOT_KEY, CacheHeaders.NONE);
CacheReference heroReference = (CacheReference) record.field(TEST_FIELD_KEY_EMPIRE);
final Record hero = normalizedCache.loadRecord(heroReference.key(), CacheHeaders.NONE);
assertThat(hero.field("homePlanet")).isEqualTo("Tatooine");
assertThat(hero.field("__typename")).isEqualTo("Human");
}
use of com.apollographql.apollo.integration.normalizer.HeroTypeDependentAliasedFieldQuery in project apollo-android by apollographql.
the class ResponseNormalizationTest method testHeroTypeDependentAliasedFieldQueryDroid.
@Test
public void testHeroTypeDependentAliasedFieldQueryDroid() throws Exception {
assertHasNoErrors("HeroTypeDependentAliasedFieldResponse.json", new HeroTypeDependentAliasedFieldQuery(Input.fromNullable(JEDI)));
Record record = normalizedCache.loadRecord(QUERY_ROOT_KEY, CacheHeaders.NONE);
CacheReference heroReference = (CacheReference) record.field(TEST_FIELD_KEY_JEDI);
final Record hero = normalizedCache.loadRecord(heroReference.key(), CacheHeaders.NONE);
assertThat(hero.field("primaryFunction")).isEqualTo("Astromech");
assertThat(hero.field("__typename")).isEqualTo("Droid");
}
use of com.apollographql.apollo.integration.normalizer.HeroTypeDependentAliasedFieldQuery in project apollo-android by apollographql.
the class ResponseNormalizationTest method testHeroTypeDependentAliasedFieldQueryHuman.
@Test
public void testHeroTypeDependentAliasedFieldQueryHuman() throws Exception {
assertHasNoErrors("HeroTypeDependentAliasedFieldResponseHuman.json", new HeroTypeDependentAliasedFieldQuery(Input.fromNullable(EMPIRE)));
Record record = normalizedCache.loadRecord(QUERY_ROOT_KEY, CacheHeaders.NONE);
CacheReference heroReference = (CacheReference) record.field(TEST_FIELD_KEY_EMPIRE);
final Record hero = normalizedCache.loadRecord(heroReference.key(), CacheHeaders.NONE);
assertThat(hero.field("homePlanet")).isEqualTo("Tatooine");
assertThat(hero.field("__typename")).isEqualTo("Human");
}
Aggregations