From a26c4f2148e765834a01f486c96bb263e077a279 Mon Sep 17 00:00:00 2001 From: eaxdev Date: Thu, 11 Jun 2020 22:03:30 +0300 Subject: [PATCH] improve test coverage --- .../io/github/eaxdev/jsonsql4j/query/DeleteTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/java/io/github/eaxdev/jsonsql4j/query/DeleteTest.java b/src/test/java/io/github/eaxdev/jsonsql4j/query/DeleteTest.java index 5473a96..700d7f8 100644 --- a/src/test/java/io/github/eaxdev/jsonsql4j/query/DeleteTest.java +++ b/src/test/java/io/github/eaxdev/jsonsql4j/query/DeleteTest.java @@ -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 @@ -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()); + } }