Skip to content

Commit

Permalink
improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
eaxdev committed Jun 11, 2020
1 parent 544f794 commit a26c4f2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/java/io/github/eaxdev/jsonsql4j/query/DeleteTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package io.github.eaxdev.jsonsql4j.query;

import io.github.eaxdev.jsonsql4j.TestUtil;
import io.github.eaxdev.jsonsql4j.exception.JsonSQL4JParseException;
import io.github.eaxdev.jsonsql4j.query.delete.DeleteQuery;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

/**
* @author eaxdev
Expand Down Expand Up @@ -36,4 +38,12 @@ void shouldGetSelectWithCriteria() {
assertEquals("DELETE FROM schema.test WHERE (field3 = 5 AND field4 = 3)", deleteQuery.getQuery());
}

@Test
@DisplayName("Should get error when json is invalid")
void shouldGetErrorWhenJsonIsInvalid() {
JsonSQL4JParseException jsonSQL4JParseException = assertThrows(JsonSQL4JParseException.class,
() -> new DeleteQuery("{\"invalid:\" \"json\"}"));
assertEquals("Can not parse json query: [{\"invalid:\" \"json\"}]",
jsonSQL4JParseException.getMessage());
}
}

0 comments on commit a26c4f2

Please sign in to comment.