Result implements Serializable { public List<String> getMessages() { return messages; } @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 constructorMessages() { List<String> messages = new ArrayList<String>(1); messages.add("message"); result = new Result(messages); assertEquals(1, result.getMessages().size()); }
@Test(expected = UnsupportedOperationException.class) public void getMessages() { result.getMessages().add("message"); }