HexDumpTest: Fix assertion.
Commit e121ca0a62 added test coverage,
including a helper function assertThrows(). The implementation of that
method was buggy because it only failed the test if it was throwing the
wrong kind of RuntimeException, instead of also when the code under test
wasn't throwing an exception at all.
This CL fixes the helper function. The test still passes (none of the
code under test was relying on the incorrect assertion).
Test: atest FrameworksCoreTests:com.android.internal.util.HexDumpTest
Change-Id: I8fe3e70ada8b880a03e124cb48e204e7bb880e57
This commit is contained in:
@@ -160,8 +160,9 @@ public final class HexDumpTest extends TestCase {
|
||||
private static void assertThrows(Class<? extends RuntimeException> clazz, Runnable runnable) {
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (RuntimeException exception) {
|
||||
assertEquals(toStrackTrace(exception), clazz, exception.getClass());
|
||||
fail();
|
||||
} catch (RuntimeException expected) {
|
||||
assertEquals(toStrackTrace(expected), clazz, expected.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user