@ -32,7 +32,7 @@ import org.springframework.test.web.servlet.StubMvcResult;
@@ -32,7 +32,7 @@ import org.springframework.test.web.servlet.StubMvcResult;
* /
public class JsonPathResultMatchersTests {
private static final String RESPONSE_CONTENT = "{\"foo\": \"bar\", \"qux\": [\"baz\"], \"emptyArray\": [], \"icanhaz\": true, \"howmanies\": 5, \"cheeseburger\": {\"pickles\": true} }" ;
private static final String RESPONSE_CONTENT = "{\"foo\": \"bar\", \"qux\": [\"baz\"], \"emptyArray\": [], \"icanhaz\": true, \"howmanies\": 5, \"cheeseburger\": {\"pickles\": true}, \"emptyMap\": {} }" ;
private static final StubMvcResult stubMvcResult ;
@ -93,6 +93,10 @@ public class JsonPathResultMatchersTests {
@@ -93,6 +93,10 @@ public class JsonPathResultMatchersTests {
public void isArray ( ) throws Exception {
new JsonPathResultMatchers ( "$.qux" ) . isArray ( ) . match ( stubMvcResult ) ;
}
@Test
public void isArrayForAnEmptyArray ( ) throws Exception {
new JsonPathResultMatchers ( "$.emptyArray" ) . isArray ( ) . match ( stubMvcResult ) ;
}
@Test ( expected = AssertionError . class )
@ -100,6 +104,21 @@ public class JsonPathResultMatchersTests {
@@ -100,6 +104,21 @@ public class JsonPathResultMatchersTests {
new JsonPathResultMatchers ( "$.bar" ) . isArray ( ) . match ( stubMvcResult ) ;
}
@Test
public void isMap ( ) throws Exception {
new JsonPathResultMatchers ( "$.cheeseburger" ) . isMap ( ) . match ( stubMvcResult ) ;
}
@Test
public void isMapForAnEmptyMap ( ) throws Exception {
new JsonPathResultMatchers ( "$.emptyMap" ) . isMap ( ) . match ( stubMvcResult ) ;
}
@Test ( expected = AssertionError . class )
public void isMapNoMatch ( ) throws Exception {
new JsonPathResultMatchers ( "$.foo" ) . isMap ( ) . match ( stubMvcResult ) ;
}
@Test
public void isBoolean ( ) throws Exception {
new JsonPathResultMatchers ( "$.icanhaz" ) . isBoolean ( ) . match ( stubMvcResult ) ;
@ -120,16 +139,6 @@ public class JsonPathResultMatchersTests {
@@ -120,16 +139,6 @@ public class JsonPathResultMatchersTests {
new JsonPathResultMatchers ( "$.foo" ) . isNumber ( ) . match ( stubMvcResult ) ;
}
@Test
public void isMap ( ) throws Exception {
new JsonPathResultMatchers ( "$.cheeseburger" ) . isMap ( ) . match ( stubMvcResult ) ;
}
@Test ( expected = AssertionError . class )
public void isMapNoMatch ( ) throws Exception {
new JsonPathResultMatchers ( "$.foo" ) . isMap ( ) . match ( stubMvcResult ) ;
}
@Test
public void isString ( ) throws Exception {
new JsonPathResultMatchers ( "$.foo" ) . isString ( ) . match ( stubMvcResult ) ;