### Question:
SeResponseSet implements Serializable { public SeResponse getSingleResponse() { if (seResponses.size() != 1) { throw new IllegalStateException("This method only support ONE element"); } return seResponses.get(0); } SeResponseSet(List<SeResponse> seResponses);  SeResponseSet(SeResponse response); List<SeResponse> getResponses(); SeResponse getSingleResponse(); @Override String toString();  }### Answer:
@Test public void getSingleResponse() throws Exception { SeResponseSet set = new SeResponseSet(SeResponseTest.getASeResponse()); assertEquals(SeResponseTest.getASeResponse(), set.getSingleResponse()); }
@Test(expected = IllegalStateException.class) public void getSingleResponseFail() throws Exception { List<SeResponse> seResponses = new ArrayList<SeResponse>(); seResponses.add(SeResponseTest.getASeResponse()); seResponses.add(SeResponseTest.getASeResponse()); SeResponseSet set = new SeResponseSet(seResponses); set.getSingleResponse(); }