Use 'switch' instead of 'if'
See gh-40985
This commit is contained in:
committed by
Phillip Webb
parent
9ddb7b0238
commit
2c5934dab2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,14 +37,10 @@ class ModifiedClassPathExtensionForkParameterizedTests {
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = { "one", "two", "three" })
|
||||
void testIsInvokedOnceForEachArgument(String argument) {
|
||||
if (argument.equals("one")) {
|
||||
assertThat(arguments).isEmpty();
|
||||
}
|
||||
else if (argument.equals("two")) {
|
||||
assertThat(arguments).doesNotContain("two", "three");
|
||||
}
|
||||
else if (argument.equals("three")) {
|
||||
assertThat(arguments).doesNotContain("three");
|
||||
switch (argument) {
|
||||
case "one" -> assertThat(arguments).isEmpty();
|
||||
case "two" -> assertThat(arguments).doesNotContain("two", "three");
|
||||
case "three" -> assertThat(arguments).doesNotContain("three");
|
||||
}
|
||||
arguments.add(argument);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user