### Question:
BaseExtensionUtils { protected static void setReferenceValue( @Nonnull String url, @Nonnull IBaseHasExtensions resource, @Nullable IBaseReference value ) { resource.getExtension().removeIf( e -> url.equals( e.getUrl() ) ); if ( value != null ) { final IBaseExtension<?, ?> extension = resource.addExtension(); extension.setUrl( url ); extension.setValue( value ); } } private  BaseExtensionUtils();   }### Answer:
@Test public void resetReferenceValue() { TestPlanDefinition planDefinition = new TestPlanDefinition(); BaseExtensionUtils.setReferenceValue( "testUrl", planDefinition, new TestReference() ); BaseExtensionUtils.setReferenceValue( "testUrl", planDefinition, null ); Assert.assertTrue( planDefinition.getExtension().isEmpty() ); }
@Test public void setReferenceValue() { TestPlanDefinition planDefinition = new TestPlanDefinition(); final IBaseReference reference = new TestReference(); BaseExtensionUtils.setReferenceValue( "testUrl", planDefinition, reference ); Assert.assertEquals( 1, planDefinition.getExtension().size() ); Assert.assertEquals( "testUrl", planDefinition.getExtension().get( 0 ).getUrl() ); Assert.assertSame( reference, planDefinition.getExtension().get( 0 ).getValue() ); }