Search in sources :

Example 1 with RollbackInfo

use of android.content.rollback.RollbackInfo in project robolectric by robolectric.

the class RollbackInfoBuilderTest method build.

@Test
public void build() {
    VersionedPackage packageRolledBackFrom = new VersionedPackage("test_package", 123);
    VersionedPackage packageRolledBackTo = new VersionedPackage("test_package", 345);
    PackageRollbackInfo packageRollbackInfo = PackageRollbackInfoBuilder.newBuilder().setPackageRolledBackFrom(packageRolledBackFrom).setPackageRolledBackTo(packageRolledBackTo).build();
    RollbackInfo rollbackInfo = RollbackInfoBuilder.newBuilder().setRollbackId(1).setPackages(ImmutableList.of(packageRollbackInfo)).setIsStaged(true).setCausePackages(ImmutableList.of(packageRolledBackFrom)).setCommittedSessionId(10).build();
    assertThat(rollbackInfo).isNotNull();
    assertThat(rollbackInfo.getRollbackId()).isEqualTo(1);
    assertThat(rollbackInfo.getPackages()).containsExactly(packageRollbackInfo);
    assertThat(rollbackInfo.isStaged()).isTrue();
    assertThat(rollbackInfo.getCausePackages()).containsExactly(packageRolledBackFrom);
    assertThat(rollbackInfo.getCommittedSessionId()).isEqualTo(10);
}
Also used : RollbackInfo(android.content.rollback.RollbackInfo) PackageRollbackInfo(android.content.rollback.PackageRollbackInfo) VersionedPackage(android.content.pm.VersionedPackage) PackageRollbackInfo(android.content.rollback.PackageRollbackInfo) Test(org.junit.Test)

Example 2 with RollbackInfo

use of android.content.rollback.RollbackInfo in project robolectric by robolectric.

the class RollbackInfoBuilderTest method build_withNoSetFields.

@Test
public void build_withNoSetFields() {
    RollbackInfo rollbackInfo = RollbackInfoBuilder.newBuilder().build();
    assertThat(rollbackInfo).isNotNull();
}
Also used : RollbackInfo(android.content.rollback.RollbackInfo) PackageRollbackInfo(android.content.rollback.PackageRollbackInfo) Test(org.junit.Test)

Aggregations

PackageRollbackInfo (android.content.rollback.PackageRollbackInfo)2 RollbackInfo (android.content.rollback.RollbackInfo)2 Test (org.junit.Test)2 VersionedPackage (android.content.pm.VersionedPackage)1