summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/text
diff options
context:
space:
mode:
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo/text')
-rw-r--r--vespajlib/src/test/java/com/yahoo/text/LowercaseTestCase.java16
-rw-r--r--vespajlib/src/test/java/com/yahoo/text/StringUtilitiesTest.java31
-rw-r--r--vespajlib/src/test/java/com/yahoo/text/Utf8TestCase.java2
3 files changed, 25 insertions, 24 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/text/LowercaseTestCase.java b/vespajlib/src/test/java/com/yahoo/text/LowercaseTestCase.java
index 70374adbb16..ca3b316c11b 100644
--- a/vespajlib/src/test/java/com/yahoo/text/LowercaseTestCase.java
+++ b/vespajlib/src/test/java/com/yahoo/text/LowercaseTestCase.java
@@ -6,9 +6,7 @@ import org.junit.Test;
import java.util.Locale;
-import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
/**
* @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
@@ -20,32 +18,32 @@ public class LowercaseTestCase {
public void testAZ() {
{
String lowercase = Lowercase.toLowerCase("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- assertThat(lowercase, equalTo("abcdefghijklmnopqrstuvwxyz"));
+ assertEquals("abcdefghijklmnopqrstuvwxyz", lowercase);
}
{
String lowercase = Lowercase.toLowerCase("abcdefghijklmnopqrstuvwxyz");
- assertThat(lowercase, equalTo("abcdefghijklmnopqrstuvwxyz"));
+ assertEquals("abcdefghijklmnopqrstuvwxyz", lowercase);
}
{
String lowercase = Lowercase.toLowerCase("AbCDEfGHIJklmnoPQRStuvwXyz");
- assertThat(lowercase, equalTo("abcdefghijklmnopqrstuvwxyz"));
+ assertEquals("abcdefghijklmnopqrstuvwxyz", lowercase);
}
{
String lowercase = Lowercase.toLowerCase("@+#");
- assertThat(lowercase, equalTo("@+#"));
+ assertEquals("@+#", lowercase);
}
{
String lowercase = Lowercase.toLowerCase("[]");
- assertThat(lowercase, equalTo("[]"));
+ assertEquals("[]", lowercase);
}
{
String lowercase = Lowercase.toLowerCase("{}");
- assertThat(lowercase, equalTo("{}"));
+ assertEquals("{}", lowercase);
}
{
String lowercase = Lowercase.toLowerCase("\u00cd\u00f4");
- assertThat(lowercase, equalTo("\u00ed\u00f4"));
+ assertEquals("\u00ed\u00f4", lowercase);
}
}
diff --git a/vespajlib/src/test/java/com/yahoo/text/StringUtilitiesTest.java b/vespajlib/src/test/java/com/yahoo/text/StringUtilitiesTest.java
index b1ec37cb7d7..b68cca6e54f 100644
--- a/vespajlib/src/test/java/com/yahoo/text/StringUtilitiesTest.java
+++ b/vespajlib/src/test/java/com/yahoo/text/StringUtilitiesTest.java
@@ -1,12 +1,15 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.text;
-import java.util.Arrays;
+import java.util.List;
import org.junit.Test;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class StringUtilitiesTest {
@@ -40,7 +43,7 @@ public class StringUtilitiesTest {
@Test
public void testImplode() {
- assertEquals(StringUtilities.implode(null, null), null);
+ assertNull(StringUtilities.implode(null, null));
assertEquals(StringUtilities.implode(new String[0], null), "");
assertEquals(StringUtilities.implode(new String[] {"foo"}, null), "foo");
assertEquals(StringUtilities.implode(new String[] {"foo"}, "asdfsdfsadfsadfasdfs"), "foo");
@@ -55,17 +58,17 @@ public class StringUtilitiesTest {
@Test
public void testImplodeMultiline() {
- assertEquals(StringUtilities.implodeMultiline(Arrays.asList("foo", "bar")), "foo\nbar");
- assertEquals(StringUtilities.implodeMultiline(Arrays.asList("")), "");
- assertEquals(StringUtilities.implodeMultiline(null), null);
- assertEquals(StringUtilities.implodeMultiline(Arrays.asList("\n")), "\n");
+ assertEquals(StringUtilities.implodeMultiline(List.of("foo", "bar")), "foo\nbar");
+ assertEquals(StringUtilities.implodeMultiline(List.of("")), "");
+ assertNull(StringUtilities.implodeMultiline(null));
+ assertEquals(StringUtilities.implodeMultiline(List.of("\n")), "\n");
}
@Test
public void testTruncation() {
String a = "abbc";
- assertTrue(a == StringUtilities.truncateSequencesIfNecessary(a, 2));
- assertTrue(a != StringUtilities.truncateSequencesIfNecessary(a, 1));
+ assertSame(a, StringUtilities.truncateSequencesIfNecessary(a, 2));
+ assertNotSame(a, StringUtilities.truncateSequencesIfNecessary(a, 1));
assertEquals("abc", StringUtilities.truncateSequencesIfNecessary(a, 1));
assertEquals("abc", StringUtilities.truncateSequencesIfNecessary("aabbccc", 1));
assertEquals("abc", StringUtilities.truncateSequencesIfNecessary("abcc", 1));
@@ -77,9 +80,9 @@ public class StringUtilitiesTest {
@Test
public void testStripSuffix() {
- assertThat(StringUtilities.stripSuffix("abc.def", ".def"), is("abc"));
- assertThat(StringUtilities.stripSuffix("abc.def", ""), is("abc.def"));
- assertThat(StringUtilities.stripSuffix("", ".def"), is(""));
- assertThat(StringUtilities.stripSuffix("", ""), is(""));
+ assertEquals("abc", StringUtilities.stripSuffix("abc.def", ".def"));
+ assertEquals("abc.def", StringUtilities.stripSuffix("abc.def", ""));
+ assertTrue(StringUtilities.stripSuffix("", ".def").isEmpty());
+ assertTrue(StringUtilities.stripSuffix("", "").isEmpty());
}
}
diff --git a/vespajlib/src/test/java/com/yahoo/text/Utf8TestCase.java b/vespajlib/src/test/java/com/yahoo/text/Utf8TestCase.java
index 9e43cb3c6ea..926d19f433f 100644
--- a/vespajlib/src/test/java/com/yahoo/text/Utf8TestCase.java
+++ b/vespajlib/src/test/java/com/yahoo/text/Utf8TestCase.java
@@ -18,9 +18,9 @@ import static com.yahoo.text.Utf8.calculateBytePositions;
import static com.yahoo.text.Utf8.calculateStringPositions;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
/**