@@ -45,12 +45,12 @@ public void testInterfaceWithMissingConcreteType() throws IOException, JSONObjec
4545 // The interfaceField should have a concreteType since it's defined as a SomeInterface that does not have a default concrete type
4646 String json = "{\" interfaceField\" :{\" fromOne\" :\" 123\" }}" ;
4747
48- JSONObjectAdapterException ex = assertThrows (JSONObjectAdapterException .class , () -> {
48+ String message = assertThrows (IllegalArgumentException .class , () -> {
4949 // Call under test
5050 EntityFactory .createEntityFromJSONString (json , HasInterfaceField .class );
51- });
51+ }). getMessage () ;
5252
53- assertEquals ("Missing 'concreteType' property, cannot discriminate polymorphic type org.sagebionetworks.jstp20.SomeInterface" , ex . getCause (). getMessage () );
53+ assertEquals ("Missing 'concreteType' property, cannot discriminate polymorphic type org.sagebionetworks.jstp20.SomeInterface" , message );
5454
5555 }
5656
@@ -105,12 +105,12 @@ public void testArraOfInterfaces() throws JSONObjectAdapterException{
105105 public void testArrayOfInterfacesWithMissingConcreteType () throws JSONObjectAdapterException {
106106 String json = "{\" list\" :[{\" concreteType\" :\" org.sagebionetworks.jstp20.OneImpl\" ,\" fromOne\" :\" 123\" },{\" fromOne\" :\" 456\" }]}" ;
107107
108- JSONObjectAdapterException ex = assertThrows (JSONObjectAdapterException .class , () -> {
108+ String message = assertThrows (IllegalArgumentException .class , () -> {
109109 // Call under test
110110 EntityFactory .createEntityFromJSONString (json , HasListOfInterface .class );
111- });
111+ }). getMessage () ;
112112
113- assertEquals ("Missing 'concreteType' property, cannot discriminate polymorphic type org.sagebionetworks.jstp20.SomeInterface" , ex . getCause (). getMessage () );
113+ assertEquals ("Missing 'concreteType' property, cannot discriminate polymorphic type org.sagebionetworks.jstp20.SomeInterface" , message );
114114
115115 }
116116
0 commit comments