-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move error tests to separate test case.
- Loading branch information
Showing
2 changed files
with
29 additions
and
20 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/androidTest/java/pl/mg6/testsupport/ReparcelerErrorTestCase.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,29 @@ | ||
package pl.mg6.testsupport; | ||
|
||
import junit.framework.TestCase; | ||
|
||
import pl.mg6.testsupport.data.WithNonStaticCreator; | ||
import pl.mg6.testsupport.data.WithProtectedCreator; | ||
|
||
public class ReparcelerErrorTestCase extends TestCase { | ||
|
||
private final Reparceler reparceler = new Reparceler(); | ||
|
||
public void testWithProtectedCreatorShouldFail() { | ||
WithProtectedCreator original = new WithProtectedCreator(); | ||
ReparcelingResult<WithProtectedCreator> result = reparceler.reparcel(original); | ||
assertSame(original, result.getOriginal()); | ||
assertNull(result.getReparceled()); | ||
assertTrue(result.getError() instanceof ReparcelingError); | ||
assertEquals("Missing public static CREATOR field on class WithProtectedCreator.", result.getError().getMessage()); | ||
} | ||
|
||
public void testWithoutCreatorShouldFail() { | ||
WithNonStaticCreator original = new WithNonStaticCreator(); | ||
ReparcelingResult<WithNonStaticCreator> result = reparceler.reparcel(original); | ||
assertSame(original, result.getOriginal()); | ||
assertNull(result.getReparceled()); | ||
assertTrue(result.getError() instanceof ReparcelingError); | ||
assertEquals("Missing public static CREATOR field on class WithNonStaticCreator.", result.getError().getMessage()); | ||
} | ||
} |
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