@Test public void test_question_setId() { // GIVEN Question q = new Question(); long id = 512; // WHEN q.setId(id); // THEN assertEquals(q.getId(), id); }
@Test public void test_question_setId_0() { // GIVEN Question q = new Question(); long id = 0; try { // WHEN q.setId(id); fail("Id can not be negative or 0"); } catch (IllegalArgumentException exc) { // THEN assertEquals(exc.getMessage(), "Id can not be negative or 0"); } }