@@ -69,33 +69,37 @@ public void testSchemaExtensions() {
6969 SchemaExtension newExtension = testBase .graphClient .getSchemaExtensions ().buildRequest ().post (extension );
7070 assertEquals (extension .description , newExtension .description );
7171
72- SchemaExtension patchExtension = new SchemaExtension ();
73- List <ExtensionSchemaProperty > patchProperties = new ArrayList <>();
74- ExtensionSchemaProperty patchProperty = new ExtensionSchemaProperty ();
75- patchProperty .name = "newItem" ;
76- patchProperty .type = "String" ;
77- patchProperties .add (prop );
78- patchProperties .add (prop2 );
79- patchProperties .add (patchProperty );
80-
81- patchExtension .properties = patchProperties ;
82-
83- testBase .graphClient .getSchemaExtensions (newExtension .id ).buildRequest ().patch (patchExtension );
84- SchemaExtension updatedExtension = testBase .graphClient .getSchemaExtensions (newExtension .id ).buildRequest ().get ();
85-
86- boolean foundUpdatedProperty = false ;
87- for (ExtensionSchemaProperty updatedProperty : updatedExtension .properties ) {
88- if (updatedProperty .name .equals (patchProperty .name )) {
89- assertEquals (patchProperty .type , updatedProperty .type );
90- foundUpdatedProperty = true ;
91- break ;
72+ try {
73+ SchemaExtension patchExtension = new SchemaExtension ();
74+ List <ExtensionSchemaProperty > patchProperties = new ArrayList <>();
75+ ExtensionSchemaProperty patchProperty = new ExtensionSchemaProperty ();
76+ patchProperty .name = "newItem" ;
77+ patchProperty .type = "String" ;
78+ patchProperties .add (prop );
79+ patchProperties .add (prop2 );
80+ patchProperties .add (patchProperty );
81+
82+ patchExtension .properties = patchProperties ;
83+
84+ testBase .graphClient .getSchemaExtensions (newExtension .id ).buildRequest ().patch (patchExtension );
85+ SchemaExtension updatedExtension = testBase .graphClient .getSchemaExtensions (newExtension .id ).buildRequest ().get ();
86+
87+ boolean foundUpdatedProperty = false ;
88+ for (ExtensionSchemaProperty updatedProperty : updatedExtension .properties ) {
89+ if (updatedProperty .name .equals (patchProperty .name )) {
90+ assertEquals (patchProperty .type , updatedProperty .type );
91+ foundUpdatedProperty = true ;
92+ break ;
93+ }
9294 }
93- }
94- if (!foundUpdatedProperty ) {
95+ if (!foundUpdatedProperty ) {
96+ Assert .fail ("Patch failed on Schema Extension" );
97+ }
98+ } catch (Exception e ) {
9599 Assert .fail ("Patch failed on Schema Extension" );
100+ } finally {
101+ testBase .graphClient .getSchemaExtensions (newExtension .id ).buildRequest ().delete ();
96102 }
97-
98- testBase .graphClient .getSchemaExtensions (newExtension .id ).buildRequest ().delete ();
99103 }
100104
101105 @ Test
0 commit comments