Search in sources :

Example 1 with GetResolver

use of com.pushtorefresh.storio.contentresolver.operations.get.GetResolver in project storio by pushtorefresh.

the class DefaultStorIOContentResolverTest method typeMappingShouldWorkWithSpecifiedTypeMappingFinder.

@Test
public void typeMappingShouldWorkWithSpecifiedTypeMappingFinder() {
    TypeMappingFinder typeMappingFinder = new TypeMappingFinderImpl();
    //noinspection unchecked
    ContentResolverTypeMapping<ClassEntity> typeMapping = ContentResolverTypeMapping.builder().putResolver(mock(PutResolver.class)).getResolver(mock(GetResolver.class)).deleteResolver(mock(DeleteResolver.class)).build();
    StorIOContentResolver storIOContentResolver = DefaultStorIOContentResolver.builder().contentResolver(mock(ContentResolver.class)).typeMappingFinder(typeMappingFinder).addTypeMapping(ClassEntity.class, typeMapping).build();
    assertThat(storIOContentResolver.lowLevel().typeMapping(ClassEntity.class)).isEqualTo(typeMapping);
}
Also used : TypeMappingFinderImpl(com.pushtorefresh.storio.internal.TypeMappingFinderImpl) TypeMappingFinder(com.pushtorefresh.storio.TypeMappingFinder) GetResolver(com.pushtorefresh.storio.contentresolver.operations.get.GetResolver) StorIOContentResolver(com.pushtorefresh.storio.contentresolver.StorIOContentResolver) Test(org.junit.Test)

Example 2 with GetResolver

use of com.pushtorefresh.storio.contentresolver.operations.get.GetResolver in project storio by pushtorefresh.

the class DefaultStorIOContentResolverTest method typeMappingShouldWorkWithoutSpecifiedTypeMappingFinder.

@Test
public void typeMappingShouldWorkWithoutSpecifiedTypeMappingFinder() {
    //noinspection unchecked
    ContentResolverTypeMapping<ClassEntity> typeMapping = ContentResolverTypeMapping.builder().putResolver(mock(PutResolver.class)).getResolver(mock(GetResolver.class)).deleteResolver(mock(DeleteResolver.class)).build();
    StorIOContentResolver storIOContentResolver = DefaultStorIOContentResolver.builder().contentResolver(mock(ContentResolver.class)).addTypeMapping(ClassEntity.class, typeMapping).build();
    assertThat(storIOContentResolver.lowLevel().typeMapping(ClassEntity.class)).isEqualTo(typeMapping);
}
Also used : GetResolver(com.pushtorefresh.storio.contentresolver.operations.get.GetResolver) StorIOContentResolver(com.pushtorefresh.storio.contentresolver.StorIOContentResolver) ContentResolver(android.content.ContentResolver) StorIOContentResolver(com.pushtorefresh.storio.contentresolver.StorIOContentResolver) Test(org.junit.Test)

Example 3 with GetResolver

use of com.pushtorefresh.storio.contentresolver.operations.get.GetResolver in project storio by pushtorefresh.

the class DefaultStorIOContentResolverTest method typeMappingShouldWorkForMultipleTypes.

@Test
public void typeMappingShouldWorkForMultipleTypes() {
    class AnotherEntity {
    }
    TypeMappingFinder typeMappingFinder = new TypeMappingFinderImpl();
    //noinspection unchecked
    ContentResolverTypeMapping<ClassEntity> typeMapping = ContentResolverTypeMapping.builder().putResolver(mock(PutResolver.class)).getResolver(mock(GetResolver.class)).deleteResolver(mock(DeleteResolver.class)).build();
    //noinspection unchecked
    ContentResolverTypeMapping<AnotherEntity> anotherMapping = ContentResolverTypeMapping.builder().putResolver(mock(PutResolver.class)).getResolver(mock(GetResolver.class)).deleteResolver(mock(DeleteResolver.class)).build();
    StorIOContentResolver storIOContentResolver = DefaultStorIOContentResolver.builder().contentResolver(mock(ContentResolver.class)).typeMappingFinder(typeMappingFinder).addTypeMapping(ClassEntity.class, typeMapping).addTypeMapping(AnotherEntity.class, anotherMapping).build();
    assertThat(storIOContentResolver.lowLevel().typeMapping(ClassEntity.class)).isEqualTo(typeMapping);
    assertThat(storIOContentResolver.lowLevel().typeMapping(AnotherEntity.class)).isEqualTo(anotherMapping);
}
Also used : TypeMappingFinderImpl(com.pushtorefresh.storio.internal.TypeMappingFinderImpl) TypeMappingFinder(com.pushtorefresh.storio.TypeMappingFinder) GetResolver(com.pushtorefresh.storio.contentresolver.operations.get.GetResolver) StorIOContentResolver(com.pushtorefresh.storio.contentresolver.StorIOContentResolver) ContentResolver(android.content.ContentResolver) StorIOContentResolver(com.pushtorefresh.storio.contentresolver.StorIOContentResolver) Test(org.junit.Test)

Aggregations

StorIOContentResolver (com.pushtorefresh.storio.contentresolver.StorIOContentResolver)3 GetResolver (com.pushtorefresh.storio.contentresolver.operations.get.GetResolver)3 Test (org.junit.Test)3 ContentResolver (android.content.ContentResolver)2 TypeMappingFinder (com.pushtorefresh.storio.TypeMappingFinder)2 TypeMappingFinderImpl (com.pushtorefresh.storio.internal.TypeMappingFinderImpl)2