-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PiperOrigin-RevId: 459363492
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
robolectric/src/test/java/org/robolectric/shadows/ShadowVisualVoicemailTaskTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.robolectric.shadows; | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
|
||
import android.os.Build.VERSION_CODES; | ||
import android.telephony.VisualVoicemailService.VisualVoicemailTask; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.RobolectricTestRunner; | ||
import org.robolectric.annotation.Config; | ||
import org.robolectric.shadow.api.Shadow; | ||
|
||
/** Tests for {@link ShadowVisualVoicemailTask} */ | ||
@RunWith(RobolectricTestRunner.class) | ||
@Config(minSdk = VERSION_CODES.O) | ||
public class ShadowVisualVoicemailTaskTest { | ||
|
||
private VisualVoicemailTask task; | ||
private ShadowVisualVoicemailTask shadowTask; | ||
|
||
@Before | ||
public void setup() { | ||
task = Shadow.newInstanceOf(VisualVoicemailTask.class); | ||
shadowTask = Shadow.extract(task); | ||
} | ||
|
||
@Test | ||
public void isFinished_defaultFalse() { | ||
assertThat(shadowTask.isFinished()).isFalse(); | ||
} | ||
|
||
@Test | ||
public void finish_setsIsFinishedTrue() { | ||
task.finish(); | ||
|
||
assertThat(shadowTask.isFinished()).isTrue(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
shadows/framework/src/main/java/org/robolectric/shadows/ShadowVisualVoicemailTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.robolectric.shadows; | ||
|
||
import android.os.Build.VERSION_CODES; | ||
import android.telephony.VisualVoicemailService.VisualVoicemailTask; | ||
import org.robolectric.annotation.Implementation; | ||
import org.robolectric.annotation.Implements; | ||
|
||
/** Shadow of {@link VisualVoicemailTask}. */ | ||
@Implements(value = VisualVoicemailTask.class, minSdk = VERSION_CODES.O) | ||
public class ShadowVisualVoicemailTask { | ||
|
||
private boolean isFinished; | ||
|
||
@Implementation | ||
public void finish() { | ||
isFinished = true; | ||
} | ||
|
||
public boolean isFinished() { | ||
return isFinished; | ||
} | ||
} |