1616
1717package org .springframework .restdocs .payload ;
1818
19- import java .io .IOException ;
2019import java .util .Arrays ;
2120import java .util .List ;
2221
@@ -39,64 +38,62 @@ public class JsonContentHandlerTests {
3938 public ExpectedException thrown = ExpectedException .none ();
4039
4140 @ Test
42- public void typeForFieldWithNullValueMustMatch () throws IOException {
41+ public void typeForFieldWithNullValueMustMatch () {
4342 this .thrown .expect (FieldTypesDoNotMatchException .class );
4443 new JsonContentHandler ("{\" a\" : null}" .getBytes ())
4544 .determineFieldType (new FieldDescriptor ("a" ).type (JsonFieldType .STRING ));
4645 }
4746
4847 @ Test
49- public void typeForFieldWithNotNullAndThenNullValueMustMatch () throws IOException {
48+ public void typeForFieldWithNotNullAndThenNullValueMustMatch () {
5049 this .thrown .expect (FieldTypesDoNotMatchException .class );
5150 new JsonContentHandler ("{\" a\" :[{\" id\" :1},{\" id\" :null}]}" .getBytes ())
5251 .determineFieldType (
5352 new FieldDescriptor ("a[].id" ).type (JsonFieldType .STRING ));
5453 }
5554
5655 @ Test
57- public void typeForFieldWithNullAndThenNotNullValueMustMatch () throws IOException {
56+ public void typeForFieldWithNullAndThenNotNullValueMustMatch () {
5857 this .thrown .expect (FieldTypesDoNotMatchException .class );
5958 new JsonContentHandler ("{\" a\" :[{\" id\" :null},{\" id\" :1}]}" .getBytes ())
6059 .determineFieldType (
6160 new FieldDescriptor ("a.[].id" ).type (JsonFieldType .STRING ));
6261 }
6362
6463 @ Test
65- public void typeForOptionalFieldWithNumberAndThenNullValueIsNumber ()
66- throws IOException {
64+ public void typeForOptionalFieldWithNumberAndThenNullValueIsNumber () {
6765 Object fieldType = new JsonContentHandler (
6866 "{\" a\" :[{\" id\" :1},{\" id\" :null}]}\" " .getBytes ())
6967 .determineFieldType (new FieldDescriptor ("a[].id" ).optional ());
7068 assertThat ((JsonFieldType ) fieldType , is (equalTo (JsonFieldType .NUMBER )));
7169 }
7270
7371 @ Test
74- public void typeForOptionalFieldWithNullAndThenNumberIsNumber () throws IOException {
72+ public void typeForOptionalFieldWithNullAndThenNumberIsNumber () {
7573 Object fieldType = new JsonContentHandler (
7674 "{\" a\" :[{\" id\" :null},{\" id\" :1}]}" .getBytes ())
7775 .determineFieldType (new FieldDescriptor ("a[].id" ).optional ());
7876 assertThat ((JsonFieldType ) fieldType , is (equalTo (JsonFieldType .NUMBER )));
7977 }
8078
8179 @ Test
82- public void typeForFieldWithNumberAndThenNullValueIsVaries () throws IOException {
80+ public void typeForFieldWithNumberAndThenNullValueIsVaries () {
8381 Object fieldType = new JsonContentHandler (
8482 "{\" a\" :[{\" id\" :1},{\" id\" :null}]}\" " .getBytes ())
8583 .determineFieldType (new FieldDescriptor ("a[].id" ));
8684 assertThat ((JsonFieldType ) fieldType , is (equalTo (JsonFieldType .VARIES )));
8785 }
8886
8987 @ Test
90- public void typeForFieldWithNullAndThenNumberIsVaries () throws IOException {
88+ public void typeForFieldWithNullAndThenNumberIsVaries () {
9189 Object fieldType = new JsonContentHandler (
9290 "{\" a\" :[{\" id\" :null},{\" id\" :1}]}" .getBytes ())
9391 .determineFieldType (new FieldDescriptor ("a[].id" ));
9492 assertThat ((JsonFieldType ) fieldType , is (equalTo (JsonFieldType .VARIES )));
9593 }
9694
9795 @ Test
98- public void typeForOptionalFieldWithNullValueCanBeProvidedExplicitly ()
99- throws IOException {
96+ public void typeForOptionalFieldWithNullValueCanBeProvidedExplicitly () {
10097 Object fieldType = new JsonContentHandler ("{\" a\" : null}" .getBytes ())
10198 .determineFieldType (
10299 new FieldDescriptor ("a" ).type (JsonFieldType .STRING ).optional ());
0 commit comments