[webnfc] Fix improper use of (expected = XXXException) in NFCTest.java
@Test(expected = InvalidNdefMessageException.class) indicates the test will and must throw an InvalidNdefMessageException, once the first exception gets thrown, the following code won't run and the test just goes to the end. So if a test would possibly throw more than one exception, it cannot use this mechanism. Instead we use a pattern like XXX xxx = null; try { xxx = getXXX(); } catch (XXXException e) { } assertNull(xxx); to confirm something went wrong inside getXXX(); Bug: 520391 Change-Id: Ibb681cbef1e0717ed695d7d7f2b9931739e6714c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2071715 Auto-Submit: Leon Han <leon.han@intel.com> Reviewed-by:Reilly Grant <reillyg@chromium.org> Commit-Queue: Leon Han <leon.han@intel.com> Cr-Commit-Position: refs/heads/master@{#744166}
Showing
This diff is collapsed.
Please register or sign in to comment