diff --git a/Mage.Client/src/test/java/mage/client/preference/MagePreferencesTest.java b/Mage.Client/src/test/java/mage/client/preference/MagePreferencesTest.java
index 7b9681e712..99a3daa8a9 100644
--- a/Mage.Client/src/test/java/mage/client/preference/MagePreferencesTest.java
+++ b/Mage.Client/src/test/java/mage/client/preference/MagePreferencesTest.java
@@ -4,8 +4,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
+import static org.junit.Assert.*;
public class MagePreferencesTest {
@Before
@@ -20,28 +19,28 @@ public class MagePreferencesTest {
@Test
public void testIgnoreList() throws Exception {
- assertThat(MagePreferences.ignoreList("test.com.xx").size(), is(0));
- assertThat(MagePreferences.removeIgnoredUser("test.com.xx", "test"), is(false));
+ assertEquals(0, MagePreferences.ignoreList("test.com.xx").size());
+ assertFalse(MagePreferences.removeIgnoredUser("test.com.xx", "test"));
MagePreferences.addIgnoredUser("test.com.xx", "test");
- assertThat(MagePreferences.ignoreList("test.com.xx").size(), is(1));
- assertThat(MagePreferences.ignoreList("other.com.xx").size(), is(0));
+ assertEquals(1, MagePreferences.ignoreList("test.com.xx").size());
+ assertEquals(0, MagePreferences.ignoreList("other.com.xx").size());
MagePreferences.addIgnoredUser("test.com.xx", "lul");
- assertThat(MagePreferences.ignoreList("test.com.xx").size(), is(2));
+ assertEquals(2, MagePreferences.ignoreList("test.com.xx").size());
- assertThat(MagePreferences.ignoreList("test.com.xx").contains("test"), is(true));
- assertThat(MagePreferences.ignoreList("test.com.xx").contains("lul"), is(true));
+ assertTrue(MagePreferences.ignoreList("test.com.xx").contains("test"));
+ assertTrue(MagePreferences.ignoreList("test.com.xx").contains("lul"));
- assertThat(MagePreferences.removeIgnoredUser("test.com.xx", "test"), is(true));
- assertThat(MagePreferences.removeIgnoredUser("test.com.xx", "test"), is(false));
- assertThat(MagePreferences.ignoreList("test.com.xx").size(), is(1));
+ assertTrue(MagePreferences.removeIgnoredUser("test.com.xx", "test"));
+ assertFalse(MagePreferences.removeIgnoredUser("test.com.xx", "test"));
+ assertEquals(1, MagePreferences.ignoreList("test.com.xx").size());
- assertThat(MagePreferences.removeIgnoredUser("test.com.xx", "lul"), is(true));
- assertThat(MagePreferences.removeIgnoredUser("test.com.xx", "lul"), is(false));
- assertThat(MagePreferences.ignoreList("test.com.xx").size(), is(0));
+ assertTrue(MagePreferences.removeIgnoredUser("test.com.xx", "lul"));
+ assertFalse(MagePreferences.removeIgnoredUser("test.com.xx", "lul"));
+ assertEquals(0, MagePreferences.ignoreList("test.com.xx").size());
- assertThat(MagePreferences.ignoreList("test.com.xx").contains("test"), is(false));
- assertThat(MagePreferences.ignoreList("test.com.xx").contains("lul"), is(false));
+ assertFalse(MagePreferences.ignoreList("test.com.xx").contains("test"));
+ assertFalse(MagePreferences.ignoreList("test.com.xx").contains("lul"));
}
}
\ No newline at end of file
diff --git a/Mage.Client/src/test/java/mage/client/util/IgnoreListTest.java b/Mage.Client/src/test/java/mage/client/util/IgnoreListTest.java
index 2eab361fe6..51a0dc47b4 100644
--- a/Mage.Client/src/test/java/mage/client/util/IgnoreListTest.java
+++ b/Mage.Client/src/test/java/mage/client/util/IgnoreListTest.java
@@ -5,9 +5,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import static junit.framework.TestCase.assertEquals;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
+import static junit.framework.TestCase.*;
public class IgnoreListTest {
@@ -23,42 +21,69 @@ public class IgnoreListTest {
@Test
public void ignoreListEmpty() throws Exception {
- assertThat(IgnoreList.getIgnoreListInfo("test.com.xx"), is("Current ignore list on test.com.xx (total: 0): []"));
+ assertEquals(IgnoreList.getIgnoreListInfo("test.com.xx"), "Current ignore list on test.com.xx (total: 0): []");
}
@Test
public void ignoreList() throws Exception {
final String test = IgnoreList.ignore("test.com.xx", "test");
+ assertEquals(test, "Added test to your ignore list on test.com.xx (total: 1)");
+
final String kranken = IgnoreList.ignore("test.com.xx", "kranken");
- assertThat(IgnoreList.getIgnoreListInfo("test.com.xx"), is("Current ignore list on test.com.xx (total: 2): [kranken, test]"));
- assertThat(test, is("Added test to your ignore list on test.com.xx (total: 1)"));
- assertThat(kranken, is("Added kranken to your ignore list on test.com.xx (total: 2)"));
+ assertEquals(kranken, "Added kranken to your ignore list on test.com.xx (total: 2)");
+
+ assertEquals(IgnoreList.getIgnoreListInfo("test.com.xx"), "Current ignore list on test.com.xx (total: 2): [kranken, test]");
}
@Test
public void ignore() throws Exception {
- assertThat(IgnoreList.userIsIgnored("test.com.xx", "kranken"), is(false));
- final String r = IgnoreList.ignore("test.com.xx", "kranken");
- assertThat(IgnoreList.userIsIgnored("test.com.xx", "kranken"), is(true));
- assertEquals(r, "Added kranken to your ignore list on test.com.xx (total: 1)");
+ ignore_a_user("kranken");
+ }
+
+ /**
+ * Reported bug: https://github.com/magefree/mage/issues/9682
+ */
+ @Test
+ public void ignoreNameWithSpaces() {
+ ignore_a_user("test test test");
+ }
+
+ /**
+ * Reported bug: https://github.com/magefree/mage/issues/9682
+ */
+ @Test
+ public void ignoreSpaceName() {
+ ignore_a_user(" ");
+ }
+
+ private void ignore_a_user(String username) {
+ assertFalse(IgnoreList.userIsIgnored("test.com.xx", username));
+
+ final String responce = IgnoreList.ignore("test.com.xx", username);
+ assertEquals(responce, "Added " + username + " to your ignore list on test.com.xx (total: 1)");
+
+ assertTrue(IgnoreList.userIsIgnored("test.com.xx", username));
}
@Test
public void ignoreAgain() throws Exception {
- assertThat(IgnoreList.userIsIgnored("test.com.xx", "kranken"), is(false));
+ assertFalse(IgnoreList.userIsIgnored("test.com.xx", "kranken"));
IgnoreList.ignore("test.com.xx", "kranken");
- final String r = IgnoreList.ignore("test.com.xx", "kranken");
- assertThat(IgnoreList.userIsIgnored("test.com.xx", "kranken"), is(true));
- assertEquals(r, "kranken is already on your ignore list on test.com.xx");
+
+ final String response = IgnoreList.ignore("test.com.xx", "kranken");
+ assertEquals(response, "kranken is already on your ignore list on test.com.xx");
+
+ assertTrue(IgnoreList.userIsIgnored("test.com.xx", "kranken"));
}
@Test
public void ignoreDefaultResponse() throws Exception {
- final String r1 = IgnoreList.ignore("test.com.xx", "");
- final String r2 = IgnoreList.ignore("test.com.xx", null);
- assertThat(IgnoreList.getIgnoreListInfo("test.com.xx"), is("Current ignore list on test.com.xx (total: 0): []"));
- assertEquals(r1, r2);
- assertEquals(r2, "Current ignore list on test.com.xx (total: 0): []");
+ final String response1 = IgnoreList.ignore("test.com.xx", "");
+ final String response2 = IgnoreList.ignore("test.com.xx", null);
+ assertEquals(response1, response2);
+ assertEquals(response2, "Current ignore list on test.com.xx (total: 0): []");
+
+ assertEquals(IgnoreList.getIgnoreListInfo("test.com.xx"), "Current ignore list on test.com.xx (total: 0): []");
}
@Test
@@ -66,20 +91,22 @@ public class IgnoreListTest {
for (int i = 0; i < 500; i++) {
IgnoreList.ignore("test.com.xx", "" + i);
}
- final String r = IgnoreList.ignore("test.com.xx", "lul");
- assertEquals(r, "Your ignore list is too big (max 500), remove a user to be able to add a new one.");
- assertThat(IgnoreList.getIgnoredUsers("test.com.xx").size(), is(500));
+ final String response = IgnoreList.ignore("test.com.xx", "lul");
+ assertEquals(response, "Your ignore list is too big (max 500), remove a user to be able to add a new one.");
+
+ assertEquals(IgnoreList.getIgnoredUsers("test.com.xx").size(), 500);
}
@Test
public void unignore() throws Exception {
- assertThat(IgnoreList.userIsIgnored("test.com.xx", "kranken"), is(false));
+ assertFalse(IgnoreList.userIsIgnored("test.com.xx", "kranken"));
+
IgnoreList.ignore("test.com.xx", "kranken");
- assertThat(IgnoreList.userIsIgnored("test.com.xx", "kranken"), is(true));
- final String r = IgnoreList.unignore("test.com.xx", "kranken");
- assertThat(IgnoreList.userIsIgnored("test.com.xx", "kranken"), is(false));
- assertEquals(r, "Removed kranken from your ignore list on test.com.xx (total: 0)");
+ assertTrue(IgnoreList.userIsIgnored("test.com.xx", "kranken"));
+ final String response = IgnoreList.unignore("test.com.xx", "kranken");
+ assertEquals(response, "Removed kranken from your ignore list on test.com.xx (total: 0)");
+
+ assertFalse(IgnoreList.userIsIgnored("test.com.xx", "kranken"));
}
-
}
\ No newline at end of file
diff --git a/Mage.Tests/src/frozen/org/mage/test/clientside/bdd/Expect.java b/Mage.Tests/src/frozen/org/mage/test/clientside/bdd/Expect.java
index 481bea72e3..97e0ff0c8c 100644
--- a/Mage.Tests/src/frozen/org/mage/test/clientside/bdd/Expect.java
+++ b/Mage.Tests/src/frozen/org/mage/test/clientside/bdd/Expect.java
@@ -3,7 +3,7 @@ package org.mage.test.clientside.bdd;
import org.junit.Assert;
import org.mage.test.clientside.base.Command;
-import static org.hamcrest.CoreMatchers.is;
+import static junit.framework.TestCase.*;
/**
* Asserts expecting exception.
@@ -15,7 +15,7 @@ public class Expect {
try {
command.execute();
} catch (Throwable e) {
- Assert.assertThat(t.getName(), is(e.getClass().getName()));
+ assertEquals(e.getClass().getName(), t.getName())
return;
}
throw new AssertionError("Expected exception wasn't thrown: " + t.getName());
diff --git a/Mage.Tests/src/frozen/org/mage/test/clientside/bdd/and/Graveyards.java b/Mage.Tests/src/frozen/org/mage/test/clientside/bdd/and/Graveyards.java
index 3041bd51ef..43fba7cf46 100644
--- a/Mage.Tests/src/frozen/org/mage/test/clientside/bdd/and/Graveyards.java
+++ b/Mage.Tests/src/frozen/org/mage/test/clientside/bdd/and/Graveyards.java
@@ -5,7 +5,7 @@ import org.mage.test.clientside.base.MageAPI;
import org.mage.test.clientside.base.MageBase;
import org.mage.test.clientside.bdd.StepState;
-import static org.hamcrest.core.Is.is;
+import static junit.framework.TestCase.*;
public class Graveyards {
private StepState step;
@@ -16,7 +16,7 @@ public class Graveyards {
StepState current = MageAPI.defineStep(this.step);
if (current.equals(StepState.THEN)) {
boolean empty = MageBase.getInstance().checkGraveyardsEmpty();
- Assert.assertThat(empty, is(true));
+ assertTrue(empty);
return empty;
} else {
throw new AssertionError("Not implemented for step="+current);
diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/vis/BroodOfCockroachesTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/vis/BroodOfCockroachesTest.java
index dec5fd9a44..a9a30055ee 100644
--- a/Mage.Tests/src/test/java/org/mage/test/cards/single/vis/BroodOfCockroachesTest.java
+++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/vis/BroodOfCockroachesTest.java
@@ -7,8 +7,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
import static mage.constants.PhaseStep.*;
import static mage.constants.Zone.BATTLEFIELD;
import static mage.constants.Zone.HAND;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertEquals;
public class BroodOfCockroachesTest extends CardTestPlayerBase {
@@ -27,7 +26,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
execute();
Permanent permanent = getPermanent(BROOD_OF_COCKROACHES, playerA);
- assertThat(permanent.getAbilities().get(1).toString(), is(expectedText));
+ assertEquals(expectedText, permanent.getAbilities().get(1).toString());
}
@Test
diff --git a/Mage/src/test/java/mage/ContinuousEffectImplTest.java b/Mage/src/test/java/mage/ContinuousEffectImplTest.java
index 8c48825e76..9e3f6dd9f9 100644
--- a/Mage/src/test/java/mage/ContinuousEffectImplTest.java
+++ b/Mage/src/test/java/mage/ContinuousEffectImplTest.java
@@ -10,8 +10,6 @@ import java.util.ArrayList;
import java.util.Set;
import java.util.UUID;
-import static org.hamcrest.CoreMatchers.is;
-
/**
* Created by IGOUDT on 25-2-2017.
*/
@@ -22,6 +20,6 @@ public class ContinuousEffectImplTest {
BoostTargetEffect ghe = new BoostTargetEffect(0,0, Duration.Custom);
ghe.setDependedToType(DependencyType.AuraAddingRemoving);
Set x = ghe.isDependentTo(new ArrayList<>());
- Assert.assertThat(x.size(), is(0));
+ Assert.assertEquals(0, x.size());
}
}