Skip to content

Commit 8fdb6bf

Browse files
author
DvirDukhan
committed
modified exception verification
1 parent 1af4700 commit 8fdb6bf

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/test/java/com/redislabs/redisgraph/impl/UtilsTest.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
import java.util.Map;
88

99
import org.junit.Assert;
10+
import org.junit.Rule;
1011
import org.junit.Test;
12+
import org.junit.rules.ExpectedException;
1113

1214
public class UtilsTest {
1315

@@ -24,17 +26,19 @@ public void testPrepareProcedure() {
2426

2527
Assert.assertEquals("CALL prc()ka,kb", Utils.prepareProcedure("prc", Arrays.asList(new String[]{}), kwargs));
2628
}
27-
29+
30+
@Rule
31+
public ExpectedException exceptionRule = ExpectedException.none();
32+
33+
2834
@Test
2935
public void prepareQuery() {
3036
Assert.assertEquals("query %s %d end of query", Utils.prepareQuery("query %s %d end of query"));
3137

3238
Assert.assertEquals("query 'a' 33 end of query", Utils.prepareQuery("query %s %d end of query", "a", 33));
33-
34-
try {
35-
Assert.assertEquals("CALL prc(\"a\",\"b\")ka,kb", Utils.prepareQuery("query %s %d end of query", "a", "b"));
36-
Assert.fail();
37-
} catch (IllegalFormatConversionException e) {}
39+
40+
exceptionRule.expect(IllegalFormatConversionException.class);
41+
Assert.assertEquals("CAL prc(\"a\",\"b\")ka,kb", Utils.prepareQuery("query %s %d end of query", "a", "b"));
3842
}
3943

4044
}

0 commit comments

Comments
 (0)