testmycode / tmc-core

The common clientside implementation for tmc-clients. Used by the tmc-netbeans and the tmc-cli
3 stars 18 forks source link

Fix parsing of validation case errors #116

Closed cxcorp closed 7 years ago

cxcorp commented 7 years ago

Currently, responses with validation error information cause an exception in SubmissionResultParser during deserialization (see #109). This happens because ValidationResultImpl stores them in a Map<File, List<ValidationError>>, but the Gson JSON parser cannot resolve JSON strings into File instances. This is fixed by 3809cf8.

Fixing this bug reveals another one: the validation errors cannot be deserialized into ValidationError instances because ValidationError is an abstract class. This is fixed by 7a94b20.

nygrenh commented 7 years ago

SubmissionResultParserTest

    @Test
    public void parsesTestResultsWithFailedCheckstyle() throws IOException {
        String json = TestUtils.readJsonFile(this.getClass(), "checkstyleFailed.json");
        SubmissionResult result = parser.parseFromJson(json);
        assertThat(result.getValidations().getValidationErrors().size() > 0);
    }
nygrenh commented 7 years ago

:+1: