From 01e16a569d72e67d9cf5c441d8b894b52ccc6909 Mon Sep 17 00:00:00 2001 From: Michal Hajas Date: Mon, 4 Apr 2022 11:09:33 +0200 Subject: [PATCH] Remove usage of BiFunction from keycloak-core module Closes #11091 --- .../saml/common/util/StaxParserUtilTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/saml-core/src/test/java/org/keycloak/saml/common/util/StaxParserUtilTest.java b/saml-core/src/test/java/org/keycloak/saml/common/util/StaxParserUtilTest.java index 140bb9b0c042..579764ac0b44 100644 --- a/saml-core/src/test/java/org/keycloak/saml/common/util/StaxParserUtilTest.java +++ b/saml-core/src/test/java/org/keycloak/saml/common/util/StaxParserUtilTest.java @@ -22,7 +22,6 @@ import java.nio.charset.Charset; import java.util.NoSuchElementException; -import java.util.function.BiFunction; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLStreamException; @@ -249,9 +248,13 @@ public void testXMLBombAttack() throws XMLStreamException { } } + private interface StartElementHasQNameBooleanBiFunction { + Boolean apply(StartElement el, HasQName qName); + } + @Test public void testGetBooleanAttributeValue() throws XMLStreamException, ParsingException { - testGetBooleanAttributeValue(new BiFunction() { + testGetBooleanAttributeValue(new StartElementHasQNameBooleanBiFunction() { @Override public Boolean apply(StartElement t, HasQName u) { return StaxParserUtil.getBooleanAttributeValue(t, u); @@ -261,7 +264,7 @@ public Boolean apply(StartElement t, HasQName u) { @Test public void testGetBooleanAttributeValueRP() throws XMLStreamException, ParsingException { - testGetBooleanAttributeValue(new BiFunction() { + testGetBooleanAttributeValue(new StartElementHasQNameBooleanBiFunction() { @Override public Boolean apply(StartElement t, HasQName u) { return StaxParserUtil.getBooleanAttributeValueRP(t, u); @@ -269,7 +272,7 @@ public Boolean apply(StartElement t, HasQName u) { }); } - private void testGetBooleanAttributeValue(BiFunction predicate) throws XMLStreamException, ParsingException { + private void testGetBooleanAttributeValue(StartElementHasQNameBooleanBiFunction predicate) throws XMLStreamException, ParsingException { testGetBooleanAttributeValue("text", predicate, false); testGetBooleanAttributeValue("text", predicate, true); testGetBooleanAttributeValue("text", predicate, false); @@ -278,7 +281,7 @@ private void testGetBooleanAttributeValue(BiFunctiontext", predicate, null); } - private void testGetBooleanAttributeValue(String xml, BiFunction predicate, Boolean expectedResult) throws XMLStreamException, ParsingException { + private void testGetBooleanAttributeValue(String xml, StartElementHasQNameBooleanBiFunction predicate, Boolean expectedResult) throws XMLStreamException, ParsingException { XMLEventReader reader = StaxParserUtil.getXMLEventReader(IOUtils.toInputStream(xml, Charset.defaultCharset())); assertThat(reader.nextEvent(), instanceOf(StartDocument.class));