MessageUtil { public static ErrorResponseMessage createErrorResponse(final byte[] request, final byte[] session, final Integer flag, final String errorMessage) { final ErrorResponseMessage msg = new ErrorResponseMessage(); msg.Request = request; msg.Session = session; msg.ErrorMessage = errorMessage; msg.metaSetFlag(flag); try { msg.validateMetaData(); } catch (RexProException ex) { } return msg; }  static ErrorResponseMessage createErrorResponse(final byte[] request, final byte[] session,
                                                           final Integer flag, final String errorMessage); static SessionResponseMessage createNewSession(byte[] request, final List<String> languages); static SessionResponseMessage createEmptySession(byte[] request);  }
@Test public void createErrorResponse() { byte [] request = "request".getBytes(); byte [] session = "session".getBytes(); final ErrorResponseMessage msg = MessageUtil.createErrorResponse(request, session, ErrorResponseMessage.AUTH_FAILURE_ERROR, "error message"); Assert.assertNotNull(msg); Assert.assertEquals(request, msg.Request); Assert.assertEquals(session, msg.Session); Assert.assertEquals("error message", msg.ErrorMessage); Assert.assertEquals(ErrorResponseMessage.AUTH_FAILURE_ERROR, msg.metaGetFlag()); }