Skip to content

Commit ffbcd9b

Browse files
johnmayegonw
authored andcommitted
Remove cdk-diff dependency on cdk-test, it only used very basic assertion utilites which we can just write out or duplicate.
1 parent edee240 commit ffbcd9b

23 files changed

+122
-113
lines changed

misc/diff/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@
3333
<artifactId>cdk-interfaces</artifactId>
3434
<version>${project.parent.version}</version>
3535
</dependency>
36-
<dependency>
37-
<groupId>${project.groupId}</groupId>
38-
<artifactId>cdk-test</artifactId>
39-
<version>${project.parent.version}</version>
40-
<type>test-jar</type>
41-
<scope>test</scope>
42-
</dependency>
4336
</dependencies>
4437

4538
</project>

misc/diff/src/test/java/org/openscience/cdk/tools/diff/AtomContainerDiffTest.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
*/
1919
package org.openscience.cdk.tools.diff;
2020

21+
import static org.hamcrest.CoreMatchers.containsString;
2122
import static org.mockito.Mockito.mock;
2223
import static org.mockito.Mockito.when;
2324

2425
import java.io.IOException;
2526

26-
import org.openscience.cdk.CDKTestCase;
27+
import org.hamcrest.MatcherAssert;
2728
import org.openscience.cdk.interfaces.IAtom;
2829
import org.openscience.cdk.interfaces.IAtomContainer;
2930
import org.openscience.cdk.interfaces.IBond;
@@ -35,15 +36,15 @@
3536
/**
3637
* @cdk.module test-diff
3738
*/
38-
public class AtomContainerDiffTest extends CDKTestCase {
39+
public class AtomContainerDiffTest {
3940

4041
@Test
4142
public void testMatchAgainstItself() {
4243
IAtomContainer container = mock(IAtomContainer.class);
4344
when(container.getElectronContainerCount()).thenReturn(1);
4445
when(container.getElectronContainer(0)).thenReturn(mock(IBond.class));
4546
String result = AtomContainerDiff.diff(container, container);
46-
assertZeroLength(result);
47+
Assert.assertEquals("", result);
4748
}
4849

4950
@Test
@@ -79,11 +80,11 @@ public void testDiff() {
7980
String result = AtomContainerDiff.diff(container1, container2);
8081
Assert.assertNotNull(result);
8182
Assert.assertNotSame(0, result.length());
82-
assertContains(result, "AtomContainerDiff");
83-
assertContains(result, "BondDiff");
84-
assertContains(result, "SINGLE/DOUBLE");
85-
assertContains(result, "AtomDiff");
86-
assertContains(result, "C/O");
83+
MatcherAssert.assertThat(result, containsString( "AtomContainerDiff"));
84+
MatcherAssert.assertThat(result, containsString( "BondDiff"));
85+
MatcherAssert.assertThat(result, containsString( "SINGLE/DOUBLE"));
86+
MatcherAssert.assertThat(result, containsString( "AtomDiff"));
87+
MatcherAssert.assertThat(result, containsString( "C/O"));
8788
}
8889

8990
@Test

misc/diff/src/test/java/org/openscience/cdk/tools/diff/AtomDiffTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@
1818
*/
1919
package org.openscience.cdk.tools.diff;
2020

21-
import static org.mockito.Mockito.mock;
22-
import static org.mockito.Mockito.when;
23-
24-
import java.io.IOException;
25-
26-
import org.openscience.cdk.CDKTestCase;
27-
import org.openscience.cdk.interfaces.IAtom;
28-
import org.openscience.cdk.tools.diff.tree.IDifference;
29-
21+
import org.hamcrest.MatcherAssert;
3022
import org.junit.Assert;
3123
import org.junit.Ignore;
3224
import org.junit.Test;
25+
import org.openscience.cdk.interfaces.IAtom;
26+
import org.openscience.cdk.tools.diff.tree.IDifference;
27+
28+
import java.io.IOException;
29+
30+
import static org.hamcrest.CoreMatchers.containsString;
31+
import static org.mockito.Mockito.mock;
32+
import static org.mockito.Mockito.when;
3333

3434
/**
3535
* @cdk.module test-diff
3636
*/
37-
public class AtomDiffTest extends CDKTestCase {
37+
public class AtomDiffTest {
3838

3939
@Test
4040
public void testMatchAgainstItself() {
4141
IAtom atom1 = mock(IAtom.class);
4242
String result = AtomDiff.diff(atom1, atom1);
43-
assertZeroLength(result);
43+
Assert.assertEquals("", result);
4444
}
4545

4646
@Test
@@ -53,8 +53,8 @@ public void testDiff() {
5353
String result = AtomDiff.diff(atom1, atom2);
5454
Assert.assertNotNull(result);
5555
Assert.assertNotSame(0, result.length());
56-
assertContains(result, "AtomDiff");
57-
assertContains(result, "H/C");
56+
MatcherAssert.assertThat(result, containsString( "AtomDiff"));
57+
MatcherAssert.assertThat(result, containsString( "H/C"));
5858
}
5959

6060
@Test

misc/diff/src/test/java/org/openscience/cdk/tools/diff/AtomTypeDiffTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
*/
1919
package org.openscience.cdk.tools.diff;
2020

21+
import org.hamcrest.MatcherAssert;
2122
import org.junit.Assert;
2223
import org.junit.Test;
23-
import org.openscience.cdk.CDKTestCase;
2424
import org.openscience.cdk.interfaces.IAtomType;
2525
import org.openscience.cdk.tools.diff.tree.IDifference;
2626

27+
import static org.hamcrest.CoreMatchers.containsString;
2728
import static org.mockito.Mockito.mock;
2829
import static org.mockito.Mockito.when;
2930
import static org.openscience.cdk.interfaces.IAtomType.Hybridization.PLANAR3;
@@ -32,13 +33,13 @@
3233
/**
3334
* @cdk.module test-diff
3435
*/
35-
public class AtomTypeDiffTest extends CDKTestCase {
36+
public class AtomTypeDiffTest {
3637

3738
@Test
3839
public void testMatchAgainstItself() {
3940
IAtomType element1 = mock(IAtomType.class);
4041
String result = AtomTypeDiff.diff(element1, element1);
41-
assertZeroLength(result);
42+
Assert.assertEquals("", result);
4243
}
4344

4445
@Test
@@ -51,8 +52,8 @@ public void testDiff() {
5152
String result = AtomTypeDiff.diff(element1, element2);
5253
Assert.assertNotNull(result);
5354
Assert.assertNotSame(0, result.length());
54-
assertContains(result, "AtomTypeDiff");
55-
assertContains(result, "PLANAR3/SP3");
55+
MatcherAssert.assertThat(result, containsString( "AtomTypeDiff"));
56+
MatcherAssert.assertThat(result, containsString( "PLANAR3/SP3"));
5657
}
5758

5859
@Test

misc/diff/src/test/java/org/openscience/cdk/tools/diff/BondDiffTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,27 @@
1818
*/
1919
package org.openscience.cdk.tools.diff;
2020

21+
import org.hamcrest.MatcherAssert;
2122
import org.junit.Assert;
2223
import org.junit.Test;
23-
import org.openscience.cdk.CDKTestCase;
2424
import org.openscience.cdk.interfaces.IAtom;
2525
import org.openscience.cdk.interfaces.IBond;
2626
import org.openscience.cdk.tools.diff.tree.IDifference;
2727

28+
import static org.hamcrest.CoreMatchers.containsString;
2829
import static org.mockito.Mockito.mock;
2930
import static org.mockito.Mockito.when;
3031

3132
/**
3233
* @cdk.module test-diff
3334
*/
34-
public class BondDiffTest extends CDKTestCase {
35+
public class BondDiffTest {
3536

3637
@Test
3738
public void testMatchAgainstItself() {
3839
IBond bond1 = mock(IBond.class);
3940
String result = BondDiff.diff(bond1, bond1);
40-
assertZeroLength(result);
41+
Assert.assertEquals("", result);
4142
}
4243

4344
@Test
@@ -69,10 +70,10 @@ public void testDiff() {
6970
String result = BondDiff.diff(bond1, bond2);
7071
Assert.assertNotNull(result);
7172
Assert.assertNotSame(0, result.length());
72-
assertContains(result, "BondDiff");
73-
assertContains(result, "SINGLE/DOUBLE");
74-
assertContains(result, "AtomDiff");
75-
assertContains(result, "C/O");
73+
MatcherAssert.assertThat(result, containsString("BondDiff"));
74+
MatcherAssert.assertThat(result, containsString("SINGLE/DOUBLE"));
75+
MatcherAssert.assertThat(result, containsString("AtomDiff"));
76+
MatcherAssert.assertThat(result, containsString("C/O"));
7677
}
7778

7879
@Test

misc/diff/src/test/java/org/openscience/cdk/tools/diff/ChemObjectDiffTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,26 @@
1818
*/
1919
package org.openscience.cdk.tools.diff;
2020

21+
import org.hamcrest.MatcherAssert;
2122
import org.junit.Assert;
2223
import org.junit.Test;
23-
import org.openscience.cdk.CDKTestCase;
2424
import org.openscience.cdk.interfaces.IChemObject;
2525
import org.openscience.cdk.tools.diff.tree.IDifference;
2626

27+
import static org.hamcrest.CoreMatchers.containsString;
2728
import static org.mockito.Mockito.mock;
2829
import static org.mockito.Mockito.when;
2930

3031
/**
3132
* @cdk.module test-diff
3233
*/
33-
public class ChemObjectDiffTest extends CDKTestCase {
34+
public class ChemObjectDiffTest {
3435

3536
@Test
3637
public void testMatchAgainstItself() {
3738
IChemObject atom1 = mock(IChemObject.class);
3839
String result = ChemObjectDiff.diff(atom1, atom1);
39-
assertZeroLength(result);
40+
Assert.assertEquals("", result);
4041
}
4142

4243
@Test
@@ -49,8 +50,8 @@ public void testDiff() {
4950
String result = ChemObjectDiff.diff(atom1, atom2);
5051
Assert.assertNotNull(result);
5152
Assert.assertNotSame("Expected non-zero-length result", 0, result.length());
52-
assertContains(result, "ChemObjectDiff");
53-
assertContains(result, "F/T");
53+
MatcherAssert.assertThat(result, containsString("ChemObjectDiff"));
54+
MatcherAssert.assertThat(result, containsString("F/T"));
5455
}
5556

5657
@Test

misc/diff/src/test/java/org/openscience/cdk/tools/diff/ElectronContainerDiffTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,26 @@
1818
*/
1919
package org.openscience.cdk.tools.diff;
2020

21+
import org.hamcrest.MatcherAssert;
2122
import org.junit.Assert;
2223
import org.junit.Test;
23-
import org.openscience.cdk.CDKTestCase;
2424
import org.openscience.cdk.interfaces.IElectronContainer;
2525
import org.openscience.cdk.tools.diff.tree.IDifference;
2626

27+
import static org.hamcrest.CoreMatchers.containsString;
2728
import static org.mockito.Mockito.mock;
2829
import static org.mockito.Mockito.when;
2930

3031
/**
3132
* @cdk.module test-diff
3233
*/
33-
public class ElectronContainerDiffTest extends CDKTestCase {
34+
public class ElectronContainerDiffTest {
3435

3536
@Test
3637
public void testMatchAgainstItself() {
3738
IElectronContainer atom1 = mock(IElectronContainer.class);
3839
String result = ElectronContainerDiff.diff(atom1, atom1);
39-
assertZeroLength(result);
40+
Assert.assertEquals("", result);
4041
}
4142

4243
@Test
@@ -49,9 +50,9 @@ public void testDiff() {
4950
String result = ElectronContainerDiff.diff(ec1, ec2);
5051
Assert.assertNotNull(result);
5152
Assert.assertNotSame(0, result.length());
52-
assertContains(result, "ElectronContainerDiff");
53-
assertContains(result, "eCount");
54-
assertContains(result, "2/3");
53+
MatcherAssert.assertThat(result, containsString("ElectronContainerDiff"));
54+
MatcherAssert.assertThat(result, containsString("eCount"));
55+
MatcherAssert.assertThat(result, containsString("2/3"));
5556
}
5657

5758
@Test

misc/diff/src/test/java/org/openscience/cdk/tools/diff/ElementDiffTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,26 @@
1818
*/
1919
package org.openscience.cdk.tools.diff;
2020

21+
import org.hamcrest.MatcherAssert;
2122
import org.junit.Assert;
2223
import org.junit.Test;
23-
import org.openscience.cdk.CDKTestCase;
2424
import org.openscience.cdk.interfaces.IElement;
2525
import org.openscience.cdk.tools.diff.tree.IDifference;
2626

27+
import static org.hamcrest.CoreMatchers.containsString;
2728
import static org.mockito.Mockito.mock;
2829
import static org.mockito.Mockito.when;
2930

3031
/**
3132
* @cdk.module test-diff
3233
*/
33-
public class ElementDiffTest extends CDKTestCase {
34+
public class ElementDiffTest {
3435

3536
@Test
3637
public void testMatchAgainstItself() {
3738
IElement element1 = mock(IElement.class);
3839
String result = ElementDiff.diff(element1, element1);
39-
assertZeroLength(result);
40+
Assert.assertEquals("", result);
4041
}
4142

4243
@Test
@@ -49,8 +50,8 @@ public void testDiff() {
4950
String result = ElementDiff.diff(element1, element2);
5051
Assert.assertNotNull(result);
5152
Assert.assertNotSame(0, result.length());
52-
assertContains(result, "ElementDiff");
53-
assertContains(result, "H/C");
53+
MatcherAssert.assertThat(result, containsString("ElementDiff"));
54+
MatcherAssert.assertThat(result, containsString("H/C"));
5455
}
5556

5657
@Test

misc/diff/src/test/java/org/openscience/cdk/tools/diff/IsotopeDiffTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,26 @@
1818
*/
1919
package org.openscience.cdk.tools.diff;
2020

21+
import org.hamcrest.MatcherAssert;
2122
import org.junit.Assert;
2223
import org.junit.Test;
23-
import org.openscience.cdk.CDKTestCase;
2424
import org.openscience.cdk.interfaces.IIsotope;
2525
import org.openscience.cdk.tools.diff.tree.IDifference;
2626

27+
import static org.hamcrest.CoreMatchers.containsString;
2728
import static org.mockito.Mockito.mock;
2829
import static org.mockito.Mockito.when;
2930

3031
/**
3132
* @cdk.module test-diff
3233
*/
33-
public class IsotopeDiffTest extends CDKTestCase {
34+
public class IsotopeDiffTest {
3435

3536
@Test
3637
public void testMatchAgainstItself() {
3738
IIsotope element1 = mock(IIsotope.class);
3839
String result = IsotopeDiff.diff(element1, element1);
39-
assertZeroLength(result);
40+
Assert.assertEquals("", result);
4041
}
4142

4243
@Test
@@ -49,8 +50,8 @@ public void testDiff() {
4950
String result = IsotopeDiff.diff(element1, element2);
5051
Assert.assertNotNull(result);
5152
Assert.assertNotSame(0, result.length());
52-
assertContains(result, "IsotopeDiff");
53-
assertContains(result, "H/C");
53+
MatcherAssert.assertThat(result, containsString("IsotopeDiff"));
54+
MatcherAssert.assertThat(result, containsString("H/C"));
5455
}
5556

5657
@Test

0 commit comments

Comments
 (0)