@@ -573,15 +573,31 @@ void rendersPromptedOptionsValues() throws Exception {
573
573
.isEqualTo ("My Prompt" );
574
574
}
575
575
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
578
591
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" )
580
595
.withValueField ("my-value-field" )
581
596
.withMinItems (2L )
582
597
.withMaxItems (3L );
583
598
584
- DocumentContext result = JsonPath .parse (getCuriedObjectMapper ().writeObject (inline ));
599
+ var result = JsonPath .parse (getCuriedObjectMapper ().writeObject (options ));
600
+
585
601
assertThat (result .read ("$.inline[0].my-prompt-field" , String .class )).isEqualTo ("foo" );
586
602
assertThat (result .read ("$.inline[0].my-value-field" , String .class )).isEqualTo ("bar" );
587
603
assertThat (result .read ("$.promptField" , String .class )).isEqualTo ("my-prompt-field" );
@@ -590,18 +606,19 @@ void rendersFullInlineOptions() {
590
606
assertThat (result .read ("$.maxItems" , Long .class )).isEqualTo (3L );
591
607
}
592
608
593
- @ Test
594
- // #2257
609
+ @ Test // #2257
595
610
void rendersFullRemoteOptions () {
596
- Link link = Link .of ("/foo{?bar}" ).withType (MediaType .APPLICATION_JSON_VALUE );
597
611
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 )
599
615
.withPromptField ("my-prompt-field" )
600
616
.withValueField ("my-value-field" )
601
617
.withMinItems (2L )
602
618
.withMaxItems (3L );
603
619
604
- DocumentContext result = JsonPath .parse (getCuriedObjectMapper ().writeObject (remote ));
620
+ var result = JsonPath .parse (getCuriedObjectMapper ().writeObject (options ));
621
+
605
622
assertThat (result .read ("$.link.href" , String .class )).isEqualTo ("/foo{?bar}" );
606
623
assertThat (result .read ("$.link.type" , String .class )).isEqualTo (MediaType .APPLICATION_JSON_VALUE );
607
624
assertThat (result .read ("$.link.templated" , boolean .class )).isTrue ();
@@ -611,20 +628,6 @@ void rendersFullRemoteOptions() {
611
628
assertThat (result .read ("$.maxItems" , Long .class )).isEqualTo (3L );
612
629
}
613
630
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
-
628
631
private void assertThatPathDoesNotExist (Object toMarshall , String path ) throws Exception {
629
632
630
633
String json = getCuriedObjectMapper ().writeObject (toMarshall );
0 commit comments