Convert to assertThrows

Closes #652
This commit is contained in:
Felix Schumacher 2021-04-10 11:38:32 +02:00
parent 5df97b8a67
commit beb5e69165
1 changed files with 3 additions and 6 deletions

View File

@ -17,6 +17,8 @@
package org.apache.jmeter.junit; package org.apache.jmeter.junit;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File; import java.io.File;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.Collection; import java.util.Collection;
@ -110,12 +112,7 @@ public abstract class JMeterTestCaseJUnit extends TestCase {
throws Exception { throws Exception {
Collection<CompoundVariable> parms = new LinkedList<>(); Collection<CompoundVariable> parms = new LinkedList<>();
for (int c = 0; c < minimum; c++) { for (int c = 0; c < minimum; c++) {
try { assertThrows(InvalidVariableException.class, () -> func.setParameters(parms));
func.setParameters(parms);
fail("Should have generated InvalidVariableException for " + parms.size()
+ " parameters");
} catch (InvalidVariableException ignored) {
}
parms.add(new CompoundVariable()); parms.add(new CompoundVariable());
} }
func.setParameters(parms); func.setParameters(parms);