diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/test/WhitespaceTest.java')
-rw-r--r-- | tests/src/cgeo/geocaching/test/WhitespaceTest.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/src/cgeo/geocaching/test/WhitespaceTest.java b/tests/src/cgeo/geocaching/test/WhitespaceTest.java index 125a0cb..1ce7cc8 100644 --- a/tests/src/cgeo/geocaching/test/WhitespaceTest.java +++ b/tests/src/cgeo/geocaching/test/WhitespaceTest.java @@ -1,7 +1,9 @@ package cgeo.geocaching.test; -import cgeo.geocaching.utils.TextUtils; +import static org.assertj.core.api.Assertions.assertThat; + import cgeo.geocaching.utils.Log; +import cgeo.geocaching.utils.TextUtils; import org.apache.commons.lang3.StringUtils; @@ -11,7 +13,7 @@ import java.util.regex.Pattern; /** * This test is meant for performance measurements of different whitespace replacement implementations. * It does not test semantical correctness. - * + * */ public class WhitespaceTest extends AbstractResourceInstrumentationTestCase { @@ -27,7 +29,7 @@ public class WhitespaceTest extends AbstractResourceInstrumentationTestCase { /** * The place for the implementation to prove that the new version of replaceWhitespace is faster than * BaseUtils.replaceWhitespace() - * + * * @param data * @return */ @@ -61,7 +63,7 @@ public class WhitespaceTest extends AbstractResourceInstrumentationTestCase { final Matcher matcher = pattern.matcher(data); final String result = matcher.replaceAll(" ").trim(); final long end = System.currentTimeMillis(); - assertEquals(EXPECTED_SIZE - 1, result.length()); + assertThat(result.length()).isEqualTo(EXPECTED_SIZE - 1); Log.d((end - start) + " ms regex"); } @@ -69,7 +71,7 @@ public class WhitespaceTest extends AbstractResourceInstrumentationTestCase { final long start = System.currentTimeMillis(); final String result = data.replaceAll("\\s+", " "); final long end = System.currentTimeMillis(); - assertEquals(EXPECTED_SIZE + 1, result.length()); + assertThat(result.length()).isEqualTo(EXPECTED_SIZE + 1); Log.d((end - start) + " ms replaceAll"); } @@ -78,7 +80,7 @@ public class WhitespaceTest extends AbstractResourceInstrumentationTestCase { final long start = System.currentTimeMillis(); result = TextUtils.replaceWhitespace(data); final long end = System.currentTimeMillis(); - assertEquals(EXPECTED_SIZE, result.length()); + assertThat(result.length()).isEqualTo(EXPECTED_SIZE); Log.d((end - start) + " ms actual implementation"); } @@ -87,7 +89,7 @@ public class WhitespaceTest extends AbstractResourceInstrumentationTestCase { final long start = System.currentTimeMillis(); result = replaceWhitespaceManually(data); final long end = System.currentTimeMillis(); - assertEquals(EXPECTED_SIZE, result.length()); + assertThat(result.length()).isEqualTo(EXPECTED_SIZE); Log.d((end - start) + " ms manually"); } @@ -96,7 +98,7 @@ public class WhitespaceTest extends AbstractResourceInstrumentationTestCase { final long start = System.currentTimeMillis(); result = replaceWhitespaceStringUtils(data); final long end = System.currentTimeMillis(); - assertEquals(EXPECTED_SIZE - 1, result.length()); + assertThat(result.length()).isEqualTo(EXPECTED_SIZE - 1); Log.d((end - start) + " ms StringUtils"); } }
\ No newline at end of file |