@Test public void testSetExpiryDate() { boolean asserttest = false; try { if (c1.getExpiryDate().length() > 10) { throw new InvalidInputException("Input exceeds required length"); } else if (c1.getExpiryDate().length() < 10) { throw new InvalidInputException("Input is less than required length"); } else if (c1.getExpiryDate().length() == 10) { // input is of type String assertEquals() asserttest = true; } } catch (InvalidInputException e) { // insert meaningful message } }
@Test public void testClient() { // checking if expirydate is valid try { if (c1.getExpiryDate().length() < 10) { throw new InvalidInputException("Input is less than required length"); } else if (c1.getExpiryDate().length() > 10) { throw new InvalidInputException("Input is more than required length"); } else if (c1.getExpiryDate().length() == 10) { // more shit } } catch (InvalidInputException e) { // insert meaningful message } }
@Test public void testGetExpiryDate() { assertEquals("2018-09-07", c1.getExpiryDate()); }