apache / accumulo-proxy

Apache Accumulo Proxy
https://accumulo.apache.org
Apache License 2.0
9 stars 19 forks source link

Use assertThrows() instead of try-catch in tests #36

Closed DomGarguilo closed 1 year ago

DomGarguilo commented 1 year ago

In the tests, there is a lot of places where an exception is expected to be thrown and instead of using JUnits assertThrows(), a try-catch block is used and then fail() is called if the expected exception is not thrown. For example:

Current:

try {
  client.clearLocatorCache(creds, doesNotExist);
  fail("exception not thrown");
} catch (TableNotFoundException ex) {}

Proposed:

assertThrows(TableNotFoundException.class, ()-> client.clearLocatorCache(creds, doesNotExist));
DomGarguilo commented 1 year ago

I am currently working on #34 and this ticket should probably wait until that is finished as to not cause merge conflicts.