diff options
author | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2022-07-27 16:46:07 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2022-07-28 14:51:33 +0200 |
commit | 76d2dd7e68ee4dc390ad9acf253e06d1d8d135c0 (patch) | |
tree | 8524a0fe140e3fdaea098a3df83af8ac0ef948d4 /predicate-search-core/src/test/java/com/yahoo/document/predicate/NegationTest.java | |
parent | a407f4643fb1ad34499d1662eab166a83d75abe8 (diff) |
Convert predicate-search-core to junit5
Diffstat (limited to 'predicate-search-core/src/test/java/com/yahoo/document/predicate/NegationTest.java')
-rw-r--r-- | predicate-search-core/src/test/java/com/yahoo/document/predicate/NegationTest.java | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/predicate-search-core/src/test/java/com/yahoo/document/predicate/NegationTest.java b/predicate-search-core/src/test/java/com/yahoo/document/predicate/NegationTest.java index 904dce795c3..2a86727c81a 100644 --- a/predicate-search-core/src/test/java/com/yahoo/document/predicate/NegationTest.java +++ b/predicate-search-core/src/test/java/com/yahoo/document/predicate/NegationTest.java @@ -1,14 +1,9 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document.predicate; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; /** * @author Simon Thoresen Hult @@ -16,12 +11,12 @@ import static org.junit.Assert.fail; public class NegationTest { @Test - public void requireThatNegationIsAnOperator() { + void requireThatNegationIsAnOperator() { assertTrue(PredicateOperator.class.isAssignableFrom(Negation.class)); } @Test - public void requireThatAccessorsWork() { + void requireThatAccessorsWork() { Predicate foo = SimplePredicates.newString("foo"); Negation node = new Negation(foo); assertSame(foo, node.getOperand()); @@ -32,7 +27,7 @@ public class NegationTest { } @Test - public void requireThatCloneIsImplemented() throws CloneNotSupportedException { + void requireThatCloneIsImplemented() throws CloneNotSupportedException { Negation node1 = new Negation(SimplePredicates.newString("a")); Negation node2 = node1.clone(); assertEquals(node1, node2); @@ -41,25 +36,25 @@ public class NegationTest { } @Test - public void requireThatHashCodeIsImplemented() { + void requireThatHashCodeIsImplemented() { Predicate predicate = SimplePredicates.newPredicate(); assertEquals(new Negation(predicate).hashCode(), new Negation(predicate).hashCode()); } @Test - public void requireThatEqualsIsImplemented() { + void requireThatEqualsIsImplemented() { Negation lhs = new Negation(SimplePredicates.newString("foo")); - assertTrue(lhs.equals(lhs)); - assertFalse(lhs.equals(new Object())); + assertEquals(lhs, lhs); + assertNotEquals(lhs, new Object()); Negation rhs = new Negation(SimplePredicates.newString("bar")); - assertFalse(lhs.equals(rhs)); + assertNotEquals(lhs, rhs); rhs.setOperand(SimplePredicates.newString("foo")); - assertTrue(lhs.equals(rhs)); + assertEquals(lhs, rhs); } @Test - public void requireThatChildIsMandatoryInConstructor() { + void requireThatChildIsMandatoryInConstructor() { try { new Negation(null); fail(); @@ -69,7 +64,7 @@ public class NegationTest { } @Test - public void requireThatChildIsMandatoryInSetter() { + void requireThatChildIsMandatoryInSetter() { Predicate operand = SimplePredicates.newPredicate(); Negation negation = new Negation(operand); try { @@ -82,7 +77,7 @@ public class NegationTest { } @Test - public void requireThatChildIsIncludedInToString() { + void requireThatChildIsIncludedInToString() { assertEquals("not (foo)", new Negation(SimplePredicates.newString("foo")).toString()); } |