From efb980c4e9b24f0639f62ed91835ebf2f7b921e1 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Fri, 10 Sep 2021 15:42:58 +0200 Subject: [PATCH] Polishing --- .../params/ParameterizedTestParameterResolver.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java index 841fab711d21..69f498215046 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java @@ -86,11 +86,11 @@ public void afterTestExecution(ExtensionContext context) { Store store = context.getStore(NAMESPACE); AtomicInteger argumentIndex = new AtomicInteger(); - Arrays.stream(arguments) // + Arrays.stream(this.arguments) // .filter(AutoCloseable.class::isInstance) // .map(AutoCloseable.class::cast) // .map(CloseableArgument::new) // - .forEach(closeable -> store.put("closeableArgument" + argumentIndex.getAndIncrement(), closeable)); + .forEach(closeable -> store.put("closeableArgument#" + argumentIndex.incrementAndGet(), closeable)); } private static class CloseableArgument implements Store.CloseableResource { @@ -103,17 +103,16 @@ private static class CloseableArgument implements Store.CloseableResource { @Override public void close() throws Throwable { - autoCloseable.close(); + this.autoCloseable.close(); } } - @SuppressWarnings("unchecked") private Object[] extractPayloads(Object[] arguments) { return Arrays.stream(arguments) // .map(argument -> { if (argument instanceof Named) { - return ((Named) argument).getPayload(); + return ((Named) argument).getPayload(); } return argument; }) //