use of com.pushtorefresh.storio3.TypeMappingFinder in project storio by pushtorefresh.
the class DefaultStorIOContentResolverTest method getTypeMappingFinder.
@Nullable
private static TypeMappingFinder getTypeMappingFinder(@NonNull DefaultStorIOContentResolver storIOContentResolver) throws NoSuchFieldException, IllegalAccessException {
Field field = DefaultStorIOContentResolver.LowLevelImpl.class.getDeclaredField("typeMappingFinder");
field.setAccessible(true);
return (TypeMappingFinder) field.get(storIOContentResolver.lowLevel());
}
use of com.pushtorefresh.storio3.TypeMappingFinder 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);
}
use of com.pushtorefresh.storio3.TypeMappingFinder 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);
}
use of com.pushtorefresh.storio3.TypeMappingFinder in project storio by pushtorefresh.
the class DefaultStorIOSQLiteTest method typeMappingShouldWorkWithSpecifiedTypeMappingFinder.
@Test
public void typeMappingShouldWorkWithSpecifiedTypeMappingFinder() {
TypeMappingFinder typeMappingFinder = new TypeMappingFinderImpl();
// noinspection unchecked
SQLiteTypeMapping<ClassEntity> typeMapping = SQLiteTypeMapping.builder().putResolver(mock(PutResolver.class)).getResolver(mock(GetResolver.class)).deleteResolver(mock(DeleteResolver.class)).build();
DefaultStorIOSQLite storIOSQLite = DefaultStorIOSQLite.builder().sqliteOpenHelper(sqLiteOpenHelper).typeMappingFinder(typeMappingFinder).addTypeMapping(ClassEntity.class, typeMapping).build();
assertThat(storIOSQLite.lowLevel().typeMapping(ClassEntity.class)).isEqualTo(typeMapping);
}
use of com.pushtorefresh.storio3.TypeMappingFinder in project storio by pushtorefresh.
the class DefaultStorIOSQLiteTest method getTypeMappingFinder.
@Nullable
private static TypeMappingFinder getTypeMappingFinder(@NonNull DefaultStorIOSQLite storIOSQLite) throws NoSuchFieldException, IllegalAccessException {
Field field = DefaultStorIOSQLite.LowLevelImpl.class.getDeclaredField("typeMappingFinder");
field.setAccessible(true);
return (TypeMappingFinder) field.get(storIOSQLite.lowLevel());
}
Aggregations