Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tests</name>
<comment>Project tests created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions tests/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3))
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/usr/lib/jvm/java-11-openjdk-amd64
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
Binary file not shown.
23 changes: 8 additions & 15 deletions tests/src/androidTest/java/io/realm/RealmRecyclerAdapterTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,12 @@ public void tearDown() {
realm.close();
}

@Test
@Test(expected = IllegalStateException.class)
@UiThreadTest
public void constructor_testRecyclerAdapterUnmanagedParameterExceptions() {
RealmResults<AllJavaTypes> resultList = realm.where(AllJavaTypes.class).findAll();
RealmList<AllJavaTypes> unmanagedRealmList = new RealmList<>(resultList.toArray(new AllJavaTypes[0]));
try {
new RecyclerViewTestAdapter(context, unmanagedRealmList, true);
fail("Should throw exception if list is un-managed");
} catch (IllegalStateException ignore) {
}
new RecyclerViewTestAdapter(context, unmanagedRealmList, true);
}

@Test
Expand Down Expand Up @@ -135,17 +131,14 @@ public void updateData_replaceInvalidData() {
realmAdapter.updateData(resultList);
}

@Test
@Test (expected = IllegalArgumentException.class)
@UiThreadTest
public void updateData_realmUnsupportedCollectionInAdapter() {
try {
RecyclerViewTestAdapter realmAdapter = new RecyclerViewTestAdapter(context, null, AUTOMATIC_UPDATE);
RealmResults<AllJavaTypes> results =
realm.where(AllJavaTypes.class).sort(AllJavaTypes.FIELD_STRING).findAll();
realmAdapter.updateData(results.createSnapshot());
fail("Should throw exception if there is unsupported collection");
} catch (IllegalArgumentException ignore) {
}
RecyclerViewTestAdapter realmAdapter = new RecyclerViewTestAdapter(context, null, AUTOMATIC_UPDATE);
RealmResults<AllJavaTypes> results =
realm.where(AllJavaTypes.class).sort(AllJavaTypes.FIELD_STRING).findAll();
realmAdapter.updateData(results.createSnapshot());

}

@Test
Expand Down