Skip to content
Permalink
Browse files
Use newer junit5 Assertion methods
  • Loading branch information
FSchumacher committed Mar 5, 2022
1 parent 9af6750 commit ee07e3c3b22fe672d3b0e1767bd8dd25ddf90b1f
Showing 1 changed file with 5 additions and 7 deletions.
@@ -17,9 +17,7 @@

package org.apache.jmeter.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;

import java.nio.file.Files;
import java.nio.file.Path;
@@ -34,17 +32,17 @@ public class TestJMeterUtils {
@Test
public void testGetResourceFileAsText() throws Exception{
String sep = System.getProperty("line.separator");
assertEquals("line one" + sep + "line two" + sep, JMeterUtils.getResourceFileAsText("resourcefile.txt"));
Assertions.assertEquals("line one" + sep + "line two" + sep, JMeterUtils.getResourceFileAsText("resourcefile.txt"));
}

@Test
public void testGetResourceFileAsTextWithMisingResource() throws Exception{
assertEquals("", JMeterUtils.getResourceFileAsText("not_existant_resourcefile.txt"));
Assertions.assertEquals("", JMeterUtils.getResourceFileAsText("not_existant_resourcefile.txt"));
}

@Test
public void testGesResStringDefaultWithNonExistantKey() throws Exception {
assertEquals("[res_key=noValidKey]", JMeterUtils.getResString("noValidKey"));
Assertions.assertEquals("[res_key=noValidKey]", JMeterUtils.getResString("noValidKey"));
}

@Test
@@ -64,13 +62,13 @@ public void testGetArrayPropDefault() throws Exception {
@Test
void testCompilePatternOK() {
Pattern pattern = JMeterUtils.compilePattern("some.*");
assertTrue(pattern.matcher("something").matches());
Assertions.assertTrue(pattern.matcher("something").matches());
}

@Test
void testCompilePatternMultilineCaseIgnoreOK() {
Pattern pattern = JMeterUtils.compilePattern("^some.*g$", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
assertTrue(pattern.matcher("abc\nsome good thing").find());
Assertions.assertTrue(pattern.matcher("abc\nsome good thing").find());
}

@Test

0 comments on commit ee07e3c

Please sign in to comment.