Skip to content

Commit 3d1b7aa

Browse files
committed
Simplify usage of Optional
1 parent 46cfefe commit 3d1b7aa

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodOrderingVisitor.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ protected boolean shouldNonMatchingDescriptorsComeBeforeOrderedOnes() {
7373
private void orderContainedMethods(ClassBasedTestDescriptor classBasedTestDescriptor, Class<?> testClass) {
7474
Optional<MethodOrderer> methodOrderer = findAnnotation(testClass, TestMethodOrder.class)//
7575
.map(TestMethodOrder::value)//
76-
.<MethodOrderer> map(ReflectionSupport::newInstance)//
77-
.map(Optional::of)//
78-
.orElseGet(configuration::getDefaultTestMethodOrderer);
76+
.<MethodOrderer> map(ReflectionSupport::newInstance) //
77+
.or(configuration::getDefaultTestMethodOrderer);
7978
orderContainedMethods(classBasedTestDescriptor, testClass, methodOrderer);
8079
}
8180

junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ default boolean isCompatible(ResourceLock other) {
9090
.filter(resource -> ExclusiveResource.COMPARATOR.compare(resource,
9191
ownResources.get(ownResources.size() - 1)) < 0);
9292

93-
return !(potentiallyDeadlockCausingAdditionalResource.isPresent());
93+
return potentiallyDeadlockCausingAdditionalResource.isEmpty();
9494
}
9595
}

0 commit comments

Comments
 (0)