• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

se-edu / addressbook-level4 / 4642 / 1
94%
master: 94%

Build:
DEFAULT BRANCH: master
Ran 09 Aug 2018 10:03AM UTC
Files 90
Run time 6s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

09 Aug 2018 09:58AM UTC coverage: 92.713% (+0.5%) from 92.168%
4642.1

push

travis-ci

web-flow
model: convert checked exceptions to runtime exceptions (#896)

DuplicatePersonException and PersonNotFoundException are checked
exceptions. They are thrown by methods to signify that their relevant
preconditions were violated.

Using checked exceptions for such a purpose is slightly useful in that
it will force callers to handle the case where the above preconditions
are not met, such as when the methods are called with invalid user
input.

However, it imposes a HUGE cost on callers where the preconditions are
already known to be met (e.g. in test code, or when the user input has
already been validated before hand). In such a case, callers are forced
to add try-catch blocks around the method call even if they know that
the exception will never be thrown, bloating up the code. It is also
impossible to test the catch blocks as well since correct code will
ensure that the precondition holds and thus the exception will never be
thrown, leading to reduced code coverage.

Checked exceptions also don't work very well with the Java Streams API,
since the API doesn't accept lambdas which could throw checked
exceptions.

In AB-4, the amount of code which benefits from DuplicatePersonException
and PersonNotFoundException being checked exceptions is much smaller
than the amount of code which is negatively impacted.

As such, let's make the tradeoff in the other direction, by making
DuplicatePersonException and PersonNotFoundException runtime exceptions.
New callers _could_ forget to check that the preconditions hold before
calling the methods in question (although test cases should catch that),
but this is balanced out by the huge benefit of having more concise and
testable code.

  [1/11] Remove redundant throws clauses
  [2/11] model: expose hasPerson(Person) functionality
  [3/11] AddCommand: explicitly perform duplicate person check
  [4/11] EditCommand: explicitly perform duplicate person check
  [5/11] model: make Dupli... (continued)

1425 of 1537 relevant lines covered (92.71%)

0.93 hits per line

Source Files on job 4642.1
  • Tree
  • List 0
  • Changed 13
  • Source Changed 12
  • Coverage Changed 11
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 4397
  • Travis Job 4642.1
  • db126b99 on github
  • Prev Job for on master (#4616.1)
  • Next Job for on master (#4643.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc