File tree Expand file tree Collapse file tree
mcp-test/src/test/java/io/modelcontextprotocol/spec Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1743,6 +1743,16 @@ void testEnumSchemaOptionDeserialization() throws Exception {
17431743 assertThat (option .title ()).isEqualTo ("Low Priority" );
17441744 }
17451745
1746+ @ Test
1747+ void testEnumSchemaOptionDeserializationWithUnknownField () throws Exception {
1748+ var option = JSON_MAPPER .readValue ("""
1749+ {
1750+ "futureField": 42
1751+ }""" , McpSchema .EnumSchemaOption .class );
1752+
1753+ assertThat (option ).isNotNull ();
1754+ }
1755+
17461756 @ Test
17471757 void testEnumSchemaOptionDeserializationWithBothFieldsMissing () throws Exception {
17481758 var option = JSON_MAPPER .readValue ("{}" , McpSchema .EnumSchemaOption .class );
@@ -1751,6 +1761,16 @@ void testEnumSchemaOptionDeserializationWithBothFieldsMissing() throws Exception
17511761 assertThat (option .title ()).isEqualTo ("" );
17521762 }
17531763
1764+ @ Test
1765+ void testEnumSchemaOptionsRequiredField () {
1766+ assertThatThrownBy (() -> new McpSchema .EnumSchemaOption ("~~~" , null ))
1767+ .isInstanceOf (IllegalArgumentException .class )
1768+ .hasMessage ("title must not be null" );
1769+ assertThatThrownBy (() -> new McpSchema .EnumSchemaOption (null , "~~~" ))
1770+ .isInstanceOf (IllegalArgumentException .class )
1771+ .hasMessage ("constValue must not be null" );
1772+ }
1773+
17541774 @ Test
17551775 void testUntitledSingleSelectEnumSchemaSerialization () throws Exception {
17561776 var schema = new McpSchema .UntitledSingleSelectEnumSchema (null , "Choose a color" ,
You can’t perform that action at this time.
0 commit comments