Response { public T retrieveData() throws SmartlingApiException { if (this.code != null && this.code != ResponseCode.SUCCESS && this.code != ResponseCode.ACCEPTED) { List<Error> errors = this.errors != null ? this.errors : Collections.<Error>emptyList(); List<String> messages = new ArrayList<>(errors.size()); for(Error error : errors) { messages.add(error.toString()); } throw new SmartlingApiException(code.toString()+ '\n' + StringUtils.join(messages, '\n'), errors); } return this.data; } Response();  Response(ResponseCode code, List<Error> errors, T data); ResponseCode getCode(); void setCode(ResponseCode code); List<Error> getErrors(); void setErrors(List<Error> errors); T getData(); T retrieveData(); void setData(T data);  }
@Test public void testRetrieveData() throws Exception { Response<FileStatus> response = new Response<>(); response.setData(new FileStatus()); response.setCode(ResponseCode.SUCCESS); assertNotNull(response.retrieveData()); }