dreamhead / moco

Easy Setup Stub Server
MIT License
4.37k stars 1.08k forks source link

maven run test with moco jsonHttpServer throw java.lang.RuntimeException: java.lang.IllegalArgumentException: unknown configuration :[Z@767df8bd #316

Open jason-UA opened 2 years ago

jason-UA commented 2 years ago

java 1.8, moco 1.3 run test at idea will success, but run maven test will fail!

    void test_update_config() throws Exception {
        ContentResource resource = pathResource("SAFRMockService.json");
        final HttpServer server = jsonHttpServer(8080, resource);
        running(server, () -> {
            final MvcResult result = sendUpdateConfigRequest();
            StatusResponse responses = mapper.readValue(result.getResponse().getContentAsString(), StatusResponse.class);
            assertThat(responses.isStatus()).isEqualTo(true);
            MSConfig databaseConfig = Converter.copy(this.configDao.getSafrConfig()).to(MSConfig.class);
            MSConfig requestConfig = Converter.copy(safrConfigRequest).to(MSConfig.class);
            assertThat(requestConfig).isEqualTo(databaseConfig);
        });
    }
[ERROR] Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 7.364 s <<< FAILURE! - in com.ms.safr.controller.ConfigIntegrationTest
[ERROR] test_update_config  Time elapsed: 0.213 s  <<< ERROR!
java.lang.RuntimeException: java.lang.IllegalArgumentException: unknown configuration :[Z@767df8bd
        at com.ms.safr.controller.ConfigIntegrationTest.test_update_config(ConfigIntegrationTest.java:60)
Caused by: java.lang.IllegalArgumentException: unknown configuration :[Z@767df8bd
        at com.ms.safr.controller.ConfigIntegrationTest.test_update_config(ConfigIntegrationTest.java:60)
shiliangui commented 2 years ago

image 在jcoco的插件配置中增加红色区域