Fix Checkstyle Error

Issue gh-9696
This commit is contained in:
Josh Cummings 2022-02-04 20:07:17 -07:00
parent 70bb588a25
commit 5c4178beb7
1 changed files with 14 additions and 15 deletions

View File

@ -42,15 +42,13 @@ import org.w3c.dom.Element;
import org.springframework.security.saml2.core.OpenSamlInitializationService; import org.springframework.security.saml2.core.OpenSamlInitializationService;
public class TestCustomOpenSamlObjects { public final class TestCustomOpenSamlObjects {
static { static {
OpenSamlInitializationService.initialize(); OpenSamlInitializationService.initialize();
XMLObjectProviderRegistrySupport.getMarshallerFactory().registerMarshaller( XMLObjectProviderRegistrySupport.getMarshallerFactory().registerMarshaller(CustomOpenSamlObject.TYPE_NAME,
CustomOpenSamlObject.TYPE_NAME,
new TestCustomOpenSamlObjects.CustomSamlObjectMarshaller()); new TestCustomOpenSamlObjects.CustomSamlObjectMarshaller());
XMLObjectProviderRegistrySupport.getUnmarshallerFactory().registerUnmarshaller( XMLObjectProviderRegistrySupport.getUnmarshallerFactory().registerUnmarshaller(CustomOpenSamlObject.TYPE_NAME,
CustomOpenSamlObject.TYPE_NAME,
new TestCustomOpenSamlObjects.CustomSamlObjectUnmarshaller()); new TestCustomOpenSamlObjects.CustomSamlObjectUnmarshaller());
} }
@ -61,8 +59,8 @@ public class TestCustomOpenSamlObjects {
CustomOpenSamlObject.TYPE_CUSTOM_PREFIX); CustomOpenSamlObject.TYPE_CUSTOM_PREFIX);
street.setTextContent("Test Street"); street.setTextContent("Test Street");
samlObject.getUnknownXMLObjects().add(street); samlObject.getUnknownXMLObjects().add(street);
XSAny streetNumber = new XSAnyBuilder().buildObject(CustomOpenSamlObject.CUSTOM_NS, XSAny streetNumber = new XSAnyBuilder().buildObject(CustomOpenSamlObject.CUSTOM_NS, "Number",
"Number", CustomOpenSamlObject.TYPE_CUSTOM_PREFIX); CustomOpenSamlObject.TYPE_CUSTOM_PREFIX);
streetNumber.setTextContent("1"); streetNumber.setTextContent("1");
samlObject.getUnknownXMLObjects().add(streetNumber); samlObject.getUnknownXMLObjects().add(streetNumber);
XSAny zip = new XSAnyBuilder().buildObject(CustomOpenSamlObject.CUSTOM_NS, "ZIP", XSAny zip = new XSAnyBuilder().buildObject(CustomOpenSamlObject.CUSTOM_NS, "ZIP",
@ -76,6 +74,10 @@ public class TestCustomOpenSamlObjects {
return samlObject; return samlObject;
} }
private TestCustomOpenSamlObjects() {
}
public interface CustomOpenSamlObject extends ElementExtensibleXMLObject { public interface CustomOpenSamlObject extends ElementExtensibleXMLObject {
String TYPE_LOCAL_NAME = "CustomType"; String TYPE_LOCAL_NAME = "CustomType";
@ -97,8 +99,7 @@ public class TestCustomOpenSamlObjects {
} }
public static class CustomOpenSamlObjectImpl extends AbstractXMLObject public static class CustomOpenSamlObjectImpl extends AbstractXMLObject implements CustomOpenSamlObject {
implements CustomOpenSamlObject {
@Nonnull @Nonnull
private IndexedXMLObjectChildrenList<XMLObject> unknownXMLObjects; private IndexedXMLObjectChildrenList<XMLObject> unknownXMLObjects;
@ -157,13 +158,12 @@ public class TestCustomOpenSamlObjects {
} }
public static class CustomSamlObjectBuilder public static class CustomSamlObjectBuilder extends AbstractXMLObjectBuilder<CustomOpenSamlObject> {
extends AbstractXMLObjectBuilder<CustomOpenSamlObject> {
@Nonnull @Nonnull
@Override @Override
public CustomOpenSamlObject buildObject(@Nullable String namespaceURI, public CustomOpenSamlObject buildObject(@Nullable String namespaceURI, @Nonnull String localName,
@Nonnull String localName, @Nullable String namespacePrefix) { @Nullable String namespacePrefix) {
return new CustomOpenSamlObjectImpl(namespaceURI, localName, namespacePrefix); return new CustomOpenSamlObjectImpl(namespaceURI, localName, namespacePrefix);
} }
@ -203,8 +203,7 @@ public class TestCustomOpenSamlObjects {
@Nonnull @Nonnull
@Override @Override
protected XMLObject buildXMLObject(@Nonnull Element domElement) { protected XMLObject buildXMLObject(@Nonnull Element domElement) {
return new CustomOpenSamlObjectImpl(SAMLConstants.SAML20_NS, return new CustomOpenSamlObjectImpl(SAMLConstants.SAML20_NS, AttributeValue.DEFAULT_ELEMENT_LOCAL_NAME,
AttributeValue.DEFAULT_ELEMENT_LOCAL_NAME,
CustomOpenSamlObject.TYPE_CUSTOM_PREFIX); CustomOpenSamlObject.TYPE_CUSTOM_PREFIX);
} }