Skip to content

ERROR : Maven test fails to run moco server when using jacoco maven plugin. #111

Description

@aelaibi

Hi,

I have used moco to mock a rest-json service , My test look like this :

@test
public void should_return_expected_response() throws Exception {
final HttpServer server = jsonHttpServer(12306, file("foo.json"));
running(server, new Runnable() {
@OverRide
public void run() throws Exception {
Contrat contrat = contratClient.getContrat(numcontrat);
Assert.assertNotNull(contrat);
}
});
}
//contratClient is a service autowiring a RestTemplate client

When I run my test under intellij-idea, it works (with green as a result), but when I try to run it via maven (using mvn clean install) it fails with the exception :

java.lang.IllegalArgumentException: unknown configuration :[Z@d78df0

When I do the same (mvn clean install) with no breakpoints it passes and with success

Do you have any idea to explain this stange behaviour ?

NB: I use windows 7, JDK 6, moco-runner V0.10.0, junit 4

Activity

  1. changed the title [-]maven test fail to run moco server.[/-] [+]ERROR : Maven test fails to run moco server.[/+] on Mar 12, 2015
  2. dreamhead commented on Mar 12, 2015

    @dreamhead
    Owner

    Could you please provide your foo.json?

  3. aelaibi commented on Mar 16, 2015

    @aelaibi
    Author

    [
    {
    "request":{
    "uri":"/service1/api/v1/contrats/",
    "queries":{
    "rib":"rib01"
    }
    },
    "response":{
    "headers":{
    "content-type":"application/json;charset=UTF-8"
    },
    "text":"[{"numContrat" : "numcontrat01", "produit" :"AGE D'OR", "statut":"O", "dateEffet":""}]"
    }
    },
    {
    "request":{
    "uri":"/service1/api/v1/contrats/numcontrat01"
    },
    "response":{
    "headers":{
    "content-type":"application/json;charset=UTF-8"
    },
    "text":"{"numContrat" : "numcontrat01", "produit" :"", "statut":"", "dateEffet":""}"
    }
    },
    {
    "response":{
    "status" :"404",
    "headers":{
    "content-type":"application/json"
    }
    }
    }
    ]

  4. aelaibi commented on Mar 16, 2015

    @aelaibi
    Author

    I guess I found the cause,

    I'm using org.jacoco:jacoco-maven-plugin v : 0.6.0.201210061924

    and it seems it adds somme $field.. that's cause problems to moco-runner.

    When I upgrade the jacoco version to 0.7.2.201409121644, my moco test runs with success !

  5. changed the title [-]ERROR : Maven test fails to run moco server.[/-] [+]ERROR : Maven test fails to run moco server when using jacoco maven plugin.[/+] on Mar 17, 2015
  6. dreamhead commented on Mar 18, 2015

    @dreamhead
    Owner

    OK, good.

  7. marcingrzejszczak commented on May 31, 2017

    @marcingrzejszczak
    Contributor

    The issue is back with jacoco >= 0.7.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions