File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/test/java/io/github/eaxdev/jsonsql4j/query Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 11package io .github .eaxdev .jsonsql4j .query ;
22
33import io .github .eaxdev .jsonsql4j .TestUtil ;
4+ import io .github .eaxdev .jsonsql4j .exception .JsonSQL4JParseException ;
45import io .github .eaxdev .jsonsql4j .query .delete .DeleteQuery ;
56import org .junit .jupiter .api .DisplayName ;
67import org .junit .jupiter .api .Test ;
78
89import 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}
You can’t perform that action at this time.
0 commit comments