Search in sources :

Example 1 with TestResultSummaryExternalInterface

use of com.facebook.buck.event.external.elements.TestResultSummaryExternalInterface in project buck by facebook.

the class BuckEventsHandlerTest method testResultSummaryExternalInterfaceKnowsResultType.

@Test
public void testResultSummaryExternalInterfaceKnowsResultType() throws Exception {
    final String json = "{\n" + "    \"testCaseName\": \"ok.api.ApiTest\",\n" + "    \"type\": \"FAILURE\",\n" + "    \"time\": 3348,\n" + "    \"message\": null,\n" + "    \"stacktrace\": null,\n" + "    \"stdOut\": \"sup from test stdout\",\n" + "    \"stdErr\": null,\n" + "    \"testName\": \"logoutAll\"\n" + "}";
    final ObjectMapper objectMapper = BuckEventsHandler.createObjectMapper();
    final TestResultSummaryExternalInterface res = objectMapper.readValue(json, TestResultSummaryExternalInterface.class);
    // because it is @JsonIgnore'd
    assertFalse(res.isSuccess());
    assertEquals(ResultType.FAILURE, res.getType());
}
Also used : TestResultSummaryExternalInterface(com.facebook.buck.event.external.elements.TestResultSummaryExternalInterface) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 2 with TestResultSummaryExternalInterface

use of com.facebook.buck.event.external.elements.TestResultSummaryExternalInterface in project buck by facebook.

the class BuckEventsHandlerTest method testResultsSummaryKnowsResultType.

@Test
public void testResultsSummaryKnowsResultType() throws Exception {
    final String json = "{\n" + "    \"testCaseName\": \"ok.api.ApiTest\",\n" + "    \"type\": \"SUCCESS\",\n" + "    \"time\": 3348,\n" + "    \"message\": null,\n" + "    \"stacktrace\": null,\n" + "    \"stdOut\": \"sup from test stdout\",\n" + "    \"stdErr\": null,\n" + "    \"testName\": \"logoutAll\"\n" + "}";
    final ObjectMapper objectMapper = BuckEventsHandler.createObjectMapper();
    final TestResultSummaryExternalInterface res = objectMapper.readValue(json, TestResultsSummary.class);
    // because it is @JsonIgnore'd
    assertFalse(res.isSuccess());
    assertEquals(ResultType.SUCCESS, res.getType());
}
Also used : TestResultSummaryExternalInterface(com.facebook.buck.event.external.elements.TestResultSummaryExternalInterface) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

TestResultSummaryExternalInterface (com.facebook.buck.event.external.elements.TestResultSummaryExternalInterface)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Test (org.junit.Test)2