Skip to content

Commit

Permalink
Use statement lambda where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Dec 17, 2024
1 parent b7ed6a3 commit 1888868
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,10 @@ private static void mockTerminateInstances(AmazonEC2Client mock) {
Mockito.doAnswer(invocationOnMock -> {
TerminateInstancesRequest request = invocationOnMock.getArgument(0);
List<Instance> instancesToRemove = new ArrayList<>();
request.getInstanceIds().forEach(instanceId -> {
instances.stream()
.filter(instance -> instance.getInstanceId().equals(instanceId))
.findFirst()
.ifPresent(instancesToRemove::add);
});
request.getInstanceIds().forEach(instanceId -> instances.stream()
.filter(instance -> instance.getInstanceId().equals(instanceId))
.findFirst()
.ifPresent(instancesToRemove::add));
instances.removeAll(instancesToRemove);
return new TerminateInstancesResult()
.withTerminatingInstances(instancesToRemove.stream()
Expand Down

0 comments on commit 1888868

Please sign in to comment.