@@ -573,15 +573,31 @@ void rendersPromptedOptionsValues() throws Exception {
573573 .isEqualTo ("My Prompt" );
574574 }
575575
576- @ Test
577- // #2257
576+ @ Test // #1483
577+ void rendersRemoteOptions () {
578+
579+ Link link = Link .of ("/foo{?bar}" ).withType (MediaType .APPLICATION_JSON_VALUE );
580+
581+ Remote remote = HalFormsOptions .remote (link );
582+
583+ DocumentContext result = JsonPath .parse (getCuriedObjectMapper ().writeObject (remote ));
584+
585+ assertThat (result .read ("$.link.href" , String .class )).isEqualTo ("/foo{?bar}" );
586+ assertThat (result .read ("$.link.type" , String .class )).isEqualTo (MediaType .APPLICATION_JSON_VALUE );
587+ assertThat (result .read ("$.link.templated" , boolean .class )).isTrue ();
588+ }
589+
590+ @ Test // #2257
578591 void rendersFullInlineOptions () {
579- Inline inline = HalFormsOptions .inline (Map .of ("my-prompt-field" , "foo" ,"my-value-field" , "bar" )).withPromptField ("my-prompt-field" )
592+
593+ var options = HalFormsOptions .inline (Map .of ("my-prompt-field" , "foo" , "my-value-field" , "bar" ))
594+ .withPromptField ("my-prompt-field" )
580595 .withValueField ("my-value-field" )
581596 .withMinItems (2L )
582597 .withMaxItems (3L );
583598
584- DocumentContext result = JsonPath .parse (getCuriedObjectMapper ().writeObject (inline ));
599+ var result = JsonPath .parse (getCuriedObjectMapper ().writeObject (options ));
600+
585601 assertThat (result .read ("$.inline[0].my-prompt-field" , String .class )).isEqualTo ("foo" );
586602 assertThat (result .read ("$.inline[0].my-value-field" , String .class )).isEqualTo ("bar" );
587603 assertThat (result .read ("$.promptField" , String .class )).isEqualTo ("my-prompt-field" );
@@ -590,18 +606,19 @@ void rendersFullInlineOptions() {
590606 assertThat (result .read ("$.maxItems" , Long .class )).isEqualTo (3L );
591607 }
592608
593- @ Test
594- // #2257
609+ @ Test // #2257
595610 void rendersFullRemoteOptions () {
596- Link link = Link .of ("/foo{?bar}" ).withType (MediaType .APPLICATION_JSON_VALUE );
597611
598- Remote remote = HalFormsOptions .remote (link )
612+ var link = Link .of ("/foo{?bar}" ).withType (MediaType .APPLICATION_JSON_VALUE );
613+
614+ var options = HalFormsOptions .remote (link )
599615 .withPromptField ("my-prompt-field" )
600616 .withValueField ("my-value-field" )
601617 .withMinItems (2L )
602618 .withMaxItems (3L );
603619
604- DocumentContext result = JsonPath .parse (getCuriedObjectMapper ().writeObject (remote ));
620+ var result = JsonPath .parse (getCuriedObjectMapper ().writeObject (options ));
621+
605622 assertThat (result .read ("$.link.href" , String .class )).isEqualTo ("/foo{?bar}" );
606623 assertThat (result .read ("$.link.type" , String .class )).isEqualTo (MediaType .APPLICATION_JSON_VALUE );
607624 assertThat (result .read ("$.link.templated" , boolean .class )).isTrue ();
@@ -611,20 +628,6 @@ void rendersFullRemoteOptions() {
611628 assertThat (result .read ("$.maxItems" , Long .class )).isEqualTo (3L );
612629 }
613630
614- @ Test // #1483
615- void rendersRemoteOptions () {
616-
617- Link link = Link .of ("/foo{?bar}" ).withType (MediaType .APPLICATION_JSON_VALUE );
618-
619- Remote remote = HalFormsOptions .remote (link );
620-
621- DocumentContext result = JsonPath .parse (getCuriedObjectMapper ().writeObject (remote ));
622-
623- assertThat (result .read ("$.link.href" , String .class )).isEqualTo ("/foo{?bar}" );
624- assertThat (result .read ("$.link.type" , String .class )).isEqualTo (MediaType .APPLICATION_JSON_VALUE );
625- assertThat (result .read ("$.link.templated" , boolean .class )).isTrue ();
626- }
627-
628631 private void assertThatPathDoesNotExist (Object toMarshall , String path ) throws Exception {
629632
630633 String json = getCuriedObjectMapper ().writeObject (toMarshall );
0 commit comments