Commit f6d17105 authored by Leon Han's avatar Leon Han Committed by Commit Bot

[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: default avatarReilly Grant <reillyg@chromium.org>
Commit-Queue: Leon Han <leon.han@intel.com>
Cr-Commit-Position: refs/heads/master@{#744166}
parent c8a31b70
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment