@Test public void testEnsureNotNegative_ValidCase() { IllegalStateException unexpected = null; try { DBQueries.ensureNotNegative(0); DBQueries.ensureNotNegative(1); } catch (IllegalStateException e) { unexpected = e; } assertNull(unexpected); }
@Test public void testEnsureNotNegative_InvalidCase() { IllegalStateException expected = null; try { DBQueries.ensureNotNegative(-1); } catch (IllegalStateException e) { expected = e; } assertNotNull(expected); assertEquals("Update returned error code: -1", expected.getMessage()); }