Skip to content

Commit f6f4378

Browse files
Revert changes in test file
1 parent 6a4425c commit f6f4378

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

samples/boot/oauth2login/src/integration-test/java/org/springframework/security/samples/OAuth2LoginApplicationTests.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
import java.util.HashSet;
6868
import java.util.List;
6969
import java.util.Map;
70+
import java.util.Optional;
7071
import java.util.Set;
7172
import java.util.stream.Collectors;
7273

@@ -330,14 +331,10 @@ private void assertIndexPage(HtmlPage page) throws Exception {
330331
}
331332

332333
private HtmlAnchor getClientAnchorElement(HtmlPage page, ClientRegistration clientRegistration) {
333-
HtmlAnchor result = null;
334-
for (HtmlAnchor anchor: page.getAnchors()) {
335-
if (anchor.asText().equals(clientRegistration.getClientName())) {
336-
result = anchor;
337-
break;
338-
}
339-
}
340-
return result;
334+
Optional<HtmlAnchor> clientAnchorElement = page.getAnchors().stream()
335+
.filter(e -> e.asText().equals(clientRegistration.getClientName())).findFirst();
336+
337+
return (clientAnchorElement.orElse(null));
341338
}
342339

343340
private WebResponse followLinkDisableRedirects(HtmlAnchor anchorElement) throws Exception {

0 commit comments

Comments
 (0)