Skip to content

Commit a26c4f2

Browse files
committed
improve test coverage
1 parent 544f794 commit a26c4f2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/test/java/io/github/eaxdev/jsonsql4j/query/DeleteTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package io.github.eaxdev.jsonsql4j.query;
22

33
import io.github.eaxdev.jsonsql4j.TestUtil;
4+
import io.github.eaxdev.jsonsql4j.exception.JsonSQL4JParseException;
45
import io.github.eaxdev.jsonsql4j.query.delete.DeleteQuery;
56
import org.junit.jupiter.api.DisplayName;
67
import org.junit.jupiter.api.Test;
78

89
import static org.junit.jupiter.api.Assertions.assertEquals;
10+
import static org.junit.jupiter.api.Assertions.assertThrows;
911

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

41+
@Test
42+
@DisplayName("Should get error when json is invalid")
43+
void shouldGetErrorWhenJsonIsInvalid() {
44+
JsonSQL4JParseException jsonSQL4JParseException = assertThrows(JsonSQL4JParseException.class,
45+
() -> new DeleteQuery("{\"invalid:\" \"json\"}"));
46+
assertEquals("Can not parse json query: [{\"invalid:\" \"json\"}]",
47+
jsonSQL4JParseException.getMessage());
48+
}
3949
}

0 commit comments

Comments
 (0)