private String generateObjectsEncodedXmi(List<EObject> objects) throws Exception {
    for (EObject eObject : objects) {
      if (eObject instanceof User) {
        User userA = (User) eObject;
        userA.setPreferredDashboardConnection(null);
      }
    }

    XMIResourceImpl resource =
        new XMIResourceImpl() {

          @Override
          protected boolean useUUIDs() {
            return true;
          }
        };
    resource.getContents().addAll(objects);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    resource.save(outputStream, Collections.EMPTY_MAP);
    return EncryptionHelper.encode64(outputStream.toByteArray());
  }
  @Test
  public void testGetWarningAction() throws Exception {
    String actionString = Action.GetWarning.toString();
    String warningMsg = "It's a warning message";
    String encodedMsg = EncryptionHelper.encode64(warningMsg.getBytes());

    when(mockHttpServletRequest.getParameter(ServletUtil.ACTION)).thenReturn(actionString);
    when(mockHttpServletRequest.getParameter(ServletUtil.VERSION)).thenReturn(versionString);

    spy(ConnectionUtil.class);

    doNothing().when(ConnectionUtil.class);
    ConnectionUtil.checkParameter(versionString);

    doNothing().when(ConnectionUtil.class);
    ConnectionUtil.checkVersion(versionString);

    doThrow(
            new org.talend.gwtadministrator.server.remoteconnection.ConnectionUtil
                .ResponseException(encodedMsg))
        .when(ConnectionUtil.class);
    ConnectionUtil.getWarnings();

    // RUN...
    defaultConnectionStrategy.execute(mockHttpServletRequest, mockHttpServletResponse);

    verifyNecessaryChecks(actionString);

    verifyStatic(org.mockito.Mockito.times(1));
    ConnectionUtil.getWarnings();

    PrintWriter writer = mockHttpServletResponse.getWriter();
    writer.flush();
    System.out.println(outStringWriter.toString());
    // ASSERT...
    assertThat(outStringWriter.toString(), is("RESPONSE:" + encodedMsg));
  }