Skip to content

Commit 5489609

Browse files
committed
Replace non-static import usage of Assert.assertThat.
1 parent 047e67e commit 5489609

File tree

42 files changed

+202
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+202
-202
lines changed

base/data/src/test/java/org/openscience/cdk/ElementTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public void testElement_X() {
7575
Assert.assertEquals("R", e.getSymbol());
7676
// and it should not throw exceptions
7777
Assert.assertNotNull(e.getAtomicNumber());
78-
Assert.assertThat(e.getAtomicNumber(), is(0));
78+
org.hamcrest.MatcherAssert.assertThat(e.getAtomicNumber(), is(0));
7979
}
8080

8181
@Test

base/datadebug/src/test/java/org/openscience/cdk/debug/DebugElementTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void testElement_X() {
7171
Assert.assertEquals("R", e.getSymbol());
7272
// and it should not throw exceptions
7373
Assert.assertNotNull(e.getAtomicNumber());
74-
Assert.assertThat(e.getAtomicNumber(), is(0));
74+
org.hamcrest.MatcherAssert.assertThat(e.getAtomicNumber(), is(0));
7575
}
7676

7777
@Test

base/silent/src/test/java/org/openscience/cdk/silent/ElementTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void testElement_X() {
7272
Assert.assertEquals("R", e.getSymbol());
7373
// and it should not throw exceptions
7474
Assert.assertNotNull(e.getAtomicNumber());
75-
Assert.assertThat(e.getAtomicNumber(), is(0));
75+
org.hamcrest.MatcherAssert.assertThat(e.getAtomicNumber(), is(0));
7676
}
7777

7878
@Test

base/test-atomtype/src/test/java/org/openscience/cdk/atomtype/SybylAtomTypeMatcherTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public void testNonExistingType() throws Exception {
196196
SybylAtomTypeMatcher matcher = SybylAtomTypeMatcher.getInstance(mol.getBuilder());
197197
IAtomType type = matcher.findMatchingAtomType(mol, atom);
198198
Assert.assertNotNull(type);
199-
Assert.assertThat(type.getAtomTypeName(), is("X"));
199+
org.hamcrest.MatcherAssert.assertThat(type.getAtomTypeName(), is("X"));
200200
}
201201

202202
@Test

base/test-core/src/test/java/org/openscience/cdk/CDKTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void testGetVersion() {
3737
String version = CDK.getVersion();
3838
Assert.assertNotNull(version);
3939
// see for the expected behavior: http://stackoverflow.com/a/3697482/217943
40-
Assert.assertThat("The CDK version in build.props is not properly overwritten by Maven.",
40+
org.hamcrest.MatcherAssert.assertThat("The CDK version in build.props is not properly overwritten by Maven.",
4141
version,
4242
not(containsString("project.version")));
4343
}

base/test-core/src/test/java/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void testNonExistingType() throws Exception {
129129
CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(DefaultChemObjectBuilder.getInstance());
130130
IAtomType type = matcher.findMatchingAtomType(mol, atom);
131131
Assert.assertNotNull(type);
132-
Assert.assertThat(type.getAtomTypeName(), is("X"));
132+
org.hamcrest.MatcherAssert.assertThat(type.getAtomTypeName(), is("X"));
133133
}
134134

135135
@Test
@@ -3054,7 +3054,7 @@ public void testAssumeExplicitHydrogens() throws Exception {
30543054
mol.getAtom(0).setFormalCharge(+1);
30553055
IAtomType type = atm.findMatchingAtomType(mol, mol.getAtom(0));
30563056
Assert.assertNotNull(type);
3057-
Assert.assertThat(type.getAtomTypeName(), is("X"));
3057+
org.hamcrest.MatcherAssert.assertThat(type.getAtomTypeName(), is("X"));
30583058

30593059
for (int i = 0; i < 3; i++) {
30603060
mol.addAtom(new Atom("H"));

base/test-core/src/test/java/org/openscience/cdk/stereo/DoubleBondStereochemistryTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,21 +186,21 @@ public void testMap_Map_Map() throws CloneNotSupportedException {
186186
// map the existing element a new element
187187
IDoubleBondStereochemistry mapped = original.map(Collections.EMPTY_MAP, mapping);
188188

189-
Assert.assertThat("mapped chiral atom was the same as the original", mapped.getStereoBond(),
189+
org.hamcrest.MatcherAssert.assertThat("mapped chiral atom was the same as the original", mapped.getStereoBond(),
190190
is(not(sameInstance(original.getStereoBond()))));
191-
Assert.assertThat("mapped chiral atom was not the clone", mapped.getStereoBond(), is(sameInstance(c1c2clone)));
191+
org.hamcrest.MatcherAssert.assertThat("mapped chiral atom was not the clone", mapped.getStereoBond(), is(sameInstance(c1c2clone)));
192192

193193
IBond[] originalBonds = original.getBonds();
194194
IBond[] mappedBonds = mapped.getBonds();
195195

196-
Assert.assertThat("first bond was te same as the original", mappedBonds[0],
196+
org.hamcrest.MatcherAssert.assertThat("first bond was te same as the original", mappedBonds[0],
197197
is(not(sameInstance(originalBonds[0]))));
198-
Assert.assertThat("first mapped bond was not the clone", mappedBonds[0], is(sameInstance(c1o3clone)));
199-
Assert.assertThat("second bond was te same as the original", mappedBonds[1],
198+
org.hamcrest.MatcherAssert.assertThat("first mapped bond was not the clone", mappedBonds[0], is(sameInstance(c1o3clone)));
199+
org.hamcrest.MatcherAssert.assertThat("second bond was te same as the original", mappedBonds[1],
200200
is(not(sameInstance(originalBonds[1]))));
201-
Assert.assertThat("second mapped bond was not the clone", mappedBonds[1], is(sameInstance(c2o4clone)));
201+
org.hamcrest.MatcherAssert.assertThat("second mapped bond was not the clone", mappedBonds[1], is(sameInstance(c2o4clone)));
202202

203-
Assert.assertThat("stereo was not mapped", mapped.getStereo(), is(original.getStereo()));
203+
org.hamcrest.MatcherAssert.assertThat("stereo was not mapped", mapped.getStereo(), is(original.getStereo()));
204204

205205
}
206206

@@ -247,7 +247,7 @@ public void testMap_Map_Map_EmptyMapping() throws CloneNotSupportedException {
247247
// map the existing element a new element - should through an IllegalArgumentException
248248
IDoubleBondStereochemistry mapped = original.map(Collections.EMPTY_MAP, Collections.EMPTY_MAP);
249249

250-
Assert.assertThat(mapped, is(sameInstance(original)));
250+
org.hamcrest.MatcherAssert.assertThat(mapped, is(sameInstance(original)));
251251
}
252252

253253
@Test

base/test-core/src/test/java/org/openscience/cdk/stereo/TetrahedralChiralityTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,27 +139,27 @@ public void testMap_Map_Map() throws CloneNotSupportedException {
139139
// map the existing element a new element
140140
ITetrahedralChirality mapped = original.map(mapping, Collections.EMPTY_MAP);
141141

142-
Assert.assertThat("mapped chiral atom was the same as the original", mapped.getChiralAtom(),
142+
org.hamcrest.MatcherAssert.assertThat("mapped chiral atom was the same as the original", mapped.getChiralAtom(),
143143
is(not(sameInstance(original.getChiralAtom()))));
144-
Assert.assertThat("mapped chiral atom was not the clone", mapped.getChiralAtom(), is(sameInstance(c1clone)));
144+
org.hamcrest.MatcherAssert.assertThat("mapped chiral atom was not the clone", mapped.getChiralAtom(), is(sameInstance(c1clone)));
145145

146146
IAtom[] originalLigands = original.getLigands();
147147
IAtom[] mappedLigands = mapped.getLigands();
148148

149-
Assert.assertThat("first ligand was te same as the original", mappedLigands[0],
149+
org.hamcrest.MatcherAssert.assertThat("first ligand was te same as the original", mappedLigands[0],
150150
is(not(sameInstance(originalLigands[0]))));
151-
Assert.assertThat("first mapped ligand was not the clone", mappedLigands[0], is(sameInstance(o2clone)));
152-
Assert.assertThat("second ligand was te same as the original", mappedLigands[1],
151+
org.hamcrest.MatcherAssert.assertThat("first mapped ligand was not the clone", mappedLigands[0], is(sameInstance(o2clone)));
152+
org.hamcrest.MatcherAssert.assertThat("second ligand was te same as the original", mappedLigands[1],
153153
is(not(sameInstance(originalLigands[1]))));
154-
Assert.assertThat("second mapped ligand was not the clone", mappedLigands[1], is(sameInstance(n3clone)));
155-
Assert.assertThat("third ligand was te same as the original", mappedLigands[2],
154+
org.hamcrest.MatcherAssert.assertThat("second mapped ligand was not the clone", mappedLigands[1], is(sameInstance(n3clone)));
155+
org.hamcrest.MatcherAssert.assertThat("third ligand was te same as the original", mappedLigands[2],
156156
is(not(sameInstance(originalLigands[2]))));
157-
Assert.assertThat("third mapped ligand was not the clone", mappedLigands[2], is(sameInstance(c4clone)));
158-
Assert.assertThat("forth ligand was te same as the original", mappedLigands[3],
157+
org.hamcrest.MatcherAssert.assertThat("third mapped ligand was not the clone", mappedLigands[2], is(sameInstance(c4clone)));
158+
org.hamcrest.MatcherAssert.assertThat("forth ligand was te same as the original", mappedLigands[3],
159159
is(not(sameInstance(originalLigands[3]))));
160-
Assert.assertThat("forth mapped ligand was not the clone", mappedLigands[3], is(sameInstance(h5clone)));
160+
org.hamcrest.MatcherAssert.assertThat("forth mapped ligand was not the clone", mappedLigands[3], is(sameInstance(h5clone)));
161161

162-
Assert.assertThat("stereo was not mapped", mapped.getStereo(), is(original.getStereo()));
162+
org.hamcrest.MatcherAssert.assertThat("stereo was not mapped", mapped.getStereo(), is(original.getStereo()));
163163

164164
}
165165

@@ -199,7 +199,7 @@ public void testMap_Map_Map_EmptyMapping() throws CloneNotSupportedException {
199199
// map the existing element a new element - should through an IllegalArgumentException
200200
ITetrahedralChirality mapped = original.map(Collections.EMPTY_MAP, Collections.EMPTY_MAP);
201201

202-
Assert.assertThat(mapped, is(sameInstance(original)));
202+
org.hamcrest.MatcherAssert.assertThat(mapped, is(sameInstance(original)));
203203
}
204204

205205
@Test

base/test-interfaces/src/test/java/org/openscience/cdk/interfaces/AbstractAtomContainerTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -598,26 +598,26 @@ public void testSetStereoElements_List() {
598598
IBond b1 = container.getBuilder().newBond();
599599
IBond b2 = container.getBuilder().newBond();
600600

601-
Assert.assertThat("empty container had stereo elements", container.stereoElements().iterator().hasNext(),
601+
org.hamcrest.MatcherAssert.assertThat("empty container had stereo elements", container.stereoElements().iterator().hasNext(),
602602
is(false));
603603

604604
List<IStereoElement> dbElements = new ArrayList<IStereoElement>();
605605
dbElements.add(new DoubleBondStereochemistry(bond, new IBond[]{b1, b2},
606606
IDoubleBondStereochemistry.Conformation.TOGETHER));
607607
container.setStereoElements(dbElements);
608608
Iterator<IStereoElement> first = container.stereoElements().iterator();
609-
Assert.assertThat("container did not have stereo elements", first.hasNext(), is(true));
610-
Assert.assertThat("expected element to equal set element (double bond)", first.next(), is(dbElements.get(0)));
611-
Assert.assertThat("container had more then one stereo element", first.hasNext(), is(false));
609+
org.hamcrest.MatcherAssert.assertThat("container did not have stereo elements", first.hasNext(), is(true));
610+
org.hamcrest.MatcherAssert.assertThat("expected element to equal set element (double bond)", first.next(), is(dbElements.get(0)));
611+
org.hamcrest.MatcherAssert.assertThat("container had more then one stereo element", first.hasNext(), is(false));
612612

613613
List<IStereoElement> tetrahedralElements = new ArrayList<IStereoElement>();
614614
tetrahedralElements.add(new TetrahedralChirality(atom, new IAtom[]{a1, a2, a3, a4}, ITetrahedralChirality.Stereo.CLOCKWISE));
615615
container.setStereoElements(tetrahedralElements);
616616
Iterator<IStereoElement> second = container.stereoElements().iterator();
617-
Assert.assertThat("container did not have stereo elements", second.hasNext(), is(true));
618-
Assert.assertThat("expected element to equal set element (tetrahedral)", second.next(),
617+
org.hamcrest.MatcherAssert.assertThat("container did not have stereo elements", second.hasNext(), is(true));
618+
org.hamcrest.MatcherAssert.assertThat("expected element to equal set element (tetrahedral)", second.next(),
619619
is(tetrahedralElements.get(0)));
620-
Assert.assertThat("container had more then one stereo element", second.hasNext(), is(false));
620+
org.hamcrest.MatcherAssert.assertThat("container had more then one stereo element", second.hasNext(), is(false));
621621

622622
}
623623

@@ -3009,7 +3009,7 @@ public void testIsEmpty() throws Exception {
30093009
container.removeAtomOnly(c1);
30103010
container.removeAtomOnly(c2);
30113011

3012-
Assert.assertThat("atom contains contains no bonds", container.getBondCount(), CoreMatchers.is(1));
3012+
org.hamcrest.MatcherAssert.assertThat("atom contains contains no bonds", container.getBondCount(), CoreMatchers.is(1));
30133013

30143014
assertTrue("atom contains contains no atoms but was not empty", container.isEmpty());
30153015

base/test-interfaces/src/test/java/org/openscience/cdk/interfaces/AbstractRingSetTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,15 +390,15 @@ public void testIsEmpty() {
390390

391391
IRingSet ringSet = (IRingSet) newChemObject();
392392

393-
Assert.assertThat("new ringset should be empty", ringSet.isEmpty(), is(true));
393+
org.hamcrest.MatcherAssert.assertThat("new ringset should be empty", ringSet.isEmpty(), is(true));
394394

395395
ringSet.addAtomContainer(ringSet.getBuilder().newInstance(IAtomContainer.class));
396396

397-
Assert.assertThat("ringset with an atom container should not be empty", ringSet.isEmpty(), is(not(true)));
397+
org.hamcrest.MatcherAssert.assertThat("ringset with an atom container should not be empty", ringSet.isEmpty(), is(not(true)));
398398

399399
ringSet.removeAllAtomContainers();
400400

401-
Assert.assertThat("ringset with removed atom containers should be empty", ringSet.isEmpty(), is(true));
401+
org.hamcrest.MatcherAssert.assertThat("ringset with removed atom containers should be empty", ringSet.isEmpty(), is(true));
402402

403403
}
404404

0 commit comments

Comments
 (0)