Result implements Serializable { public boolean isSuccessful() { return messages.isEmpty(); } @SuppressWarnings("unchecked")  Result(String data);  Result(List<String> messages);  Result(String data, List<String> messages); String getData(); List<String> getMessages(); boolean isSuccessful(); @Override String toString();  }
@Test public void isSuccessful() { assertTrue(result.isSuccessful()); List<String> messages = new ArrayList<String>(2); messages.add("message"); result = new Result("data", messages); assertFalse(result.isSuccessful()); }