Credentials implements Serializable { public boolean isEmpty() { return StringUtils.isEmpty(userName) && StringUtils.isEmpty(password); } Credentials(final String userName, final String password); String getUserName(); String getPassword(); boolean isEmpty(); @Override String toString(); static final Credentials EMPTY; }
@Test public void testIsEmpty() throws Exception { Credentials credentials = new Credentials(null, null); assertTrue(credentials.isEmpty()); credentials = new Credentials("", ""); assertTrue(credentials.isEmpty()); }