@Test
public void postModuleFailed() throws AuthenticationException{

    Module module1 = DataModelFactory.createModule("module", "1.0.0-SNAPSHOT");
    Artifact artifact1 = DataModelFactory.createArtifact("com.axway.test", "artifact1", "1.0.0-SNAPSHOT", "win32",  "jar", "");
    Artifact artifact2 = DataModelFactory.createArtifact("com.axway.test", "artifact2", "1.0.0-SNAPSHOT", "win32", "jar", "");
    Artifact dependency = DataModelFactory.createArtifact("com.axway.test", "dependency", "1.0.0-SNAPSHOT", "win32", "jar", "");
    module1.addDependency(DataModelFactory.createDependency(artifact2,Scope.COMPILE));
    module1.addDependency(DataModelFactory.createDependency(dependency, Scope.TEST));
    module1.addArtifact(artifact1);
    module1.addArtifact(artifact2);
    stubFor(post(urlEqualTo("/" + ServerAPI.MODULE_RESOURCE))
            .willReturn(aResponse()
                    .withStatus(Status.NOT_ACCEPTABLE.getStatusCode())));
    GrapesCommunicationException exception = null;
    try{
        client.postModule(module1, "user", "password");
    }catch (GrapesCommunicationException e) {
        exception = e;
    }
    assertNotNull(exception);
    assertEquals(Status.NOT_ACCEPTABLE.getStatusCode(), exception.getHttpStatus());
}