diff --git a/bds/source/java/ch/systemsx/cisd/bds/DataSet.java b/bds/source/java/ch/systemsx/cisd/bds/DataSet.java index c9110ebbcfc89bea8a7d81c1a8d6a662ef6b2559..bd2b7710f825ffd3d6fa9118fc815329f0f23edb 100644 --- a/bds/source/java/ch/systemsx/cisd/bds/DataSet.java +++ b/bds/source/java/ch/systemsx/cisd/bds/DataSet.java @@ -117,7 +117,7 @@ public final class DataSet implements IStorable this.productionTimestamp = productionTimestampOrNull; } - public final void setCode(String code) + public final void setCode(final String code) { this.code = code; } @@ -152,7 +152,7 @@ public final class DataSet implements IStorable return parentCodes; } - public final void setComplete(boolean complete) + public final void setComplete(final boolean complete) { isComplete = BooleanOrUnknown.resolve(complete); } diff --git a/bds/sourceTest/java/ch/systemsx/cisd/bds/SampleFileSystemTestCase.java b/bds/sourceTest/java/ch/systemsx/cisd/bds/SampleFileSystemTestCase.java index 9ab28d394672037b5f7ae70dba16d63915777868..2293f778501ddf5eb1e49c6c56646a0a4b213d51 100644 --- a/bds/sourceTest/java/ch/systemsx/cisd/bds/SampleFileSystemTestCase.java +++ b/bds/sourceTest/java/ch/systemsx/cisd/bds/SampleFileSystemTestCase.java @@ -17,7 +17,6 @@ package ch.systemsx.cisd.bds; import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.fail; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -52,22 +51,24 @@ public final class SampleFileSystemTestCase extends AbstractFileSystemTestCase @Test public final void testConstructor() { + boolean fail = true; try { new Sample(null, null, null); - fail("Null values not allowed."); } catch (final AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); + fail = true; try { new Sample("", "", ""); - fail("Empty values not allowed."); } catch (final AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); new Sample(" ", " ", " "); } diff --git a/bds/sourceTest/java/ch/systemsx/cisd/bds/UtilitiesTest.java b/bds/sourceTest/java/ch/systemsx/cisd/bds/UtilitiesTest.java index e49e4d3a84a42380e73f531cf525bf69f964838b..b38d9ea97f36b0816d81b5eb3a4314029bc6a5c7 100644 --- a/bds/sourceTest/java/ch/systemsx/cisd/bds/UtilitiesTest.java +++ b/bds/sourceTest/java/ch/systemsx/cisd/bds/UtilitiesTest.java @@ -61,14 +61,15 @@ public class UtilitiesTest extends AbstractFileSystemTestCase assertEquals(1, listFiles.length); assertEquals(key, listFiles[0].getName()); assertEquals(value, file.getStringContent().trim()); + boolean fail = true; try { Utilities.getNumber(null, null); - fail("Directory and name can not be null."); } catch (AssertionError ex) { - // Nothing to do here + fail = false; } + assertEquals(false, fail); try { Utilities.getNumber(directory, "doesNotExist"); @@ -83,14 +84,15 @@ public class UtilitiesTest extends AbstractFileSystemTestCase @Test public final void testListNodes() throws IOException { + boolean fail = true; try { Utilities.listNodes(null, null); - fail("Given directory can not be null."); } catch (AssertionError e) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); createFile(workingDirectory, "file1"); final File dir1 = new File(workingDirectory, "dir1"); dir1.mkdir(); @@ -110,14 +112,15 @@ public class UtilitiesTest extends AbstractFileSystemTestCase @Test public final void testGetBoolean() { + boolean fail = true; try { Utilities.getBoolean(null, null); - fail("Directory and name can not be null."); } catch (final AssertionError e) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); final IDirectory directory = (IDirectory) NodeFactory.createNode(workingDirectory); try { diff --git a/bds/sourceTest/java/ch/systemsx/cisd/bds/handler/MappingFileHandlerTest.java b/bds/sourceTest/java/ch/systemsx/cisd/bds/handler/MappingFileHandlerTest.java index d43a3bf36e6ab7ececf7bb8e500bad19f234d55a..e687ed89a2e660bae1f1fa2473bcffa7975e0a9d 100644 --- a/bds/sourceTest/java/ch/systemsx/cisd/bds/handler/MappingFileHandlerTest.java +++ b/bds/sourceTest/java/ch/systemsx/cisd/bds/handler/MappingFileHandlerTest.java @@ -95,14 +95,15 @@ public final class MappingFileHandlerTest extends AbstractFileSystemTestCase @Test public final void testAddReference() { + boolean fail = true; try { handler.addReference(null); - fail("Null value not allowed."); } catch (AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); handler.addReference(new Reference("1", "2", ReferenceType.IDENTICAL)); try { diff --git a/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/GeometryTest.java b/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/GeometryTest.java index 18f4c6e70fdf48e9d71e17da63a5fd6acedeca32..570d644826ab1b7c0067906e3be39686fac1ddcc 100644 --- a/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/GeometryTest.java +++ b/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/GeometryTest.java @@ -16,8 +16,13 @@ package ch.systemsx.cisd.bds.hcs; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertNull; +import static org.testng.AssertJUnit.assertTrue; + import org.testng.annotations.Test; -import static org.testng.AssertJUnit.*; /** * Test cases for corresponding {@link Geometry} class. @@ -31,14 +36,15 @@ public final class GeometryTest public final void testContainsLocation() { final Geometry geometry = new Geometry(2, 3); + boolean fail = true; try { geometry.contains(null); - fail("Location can not be null."); - } catch (AssertionError e) + } catch (AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); assertTrue(geometry.contains(new Location(1, 2))); assertFalse(geometry.contains(new Location(1, 3))); assertTrue(geometry.contains(new Location(3, 1))); @@ -48,27 +54,29 @@ public final class GeometryTest @Test public final void testCreateFromString() { + boolean fail = true; try { Geometry.createFromString(null); - fail("Null value not allowed here."); - } catch (AssertionError e) + } catch (AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); assertNull(Geometry.createFromString("a")); assertNull(Geometry.createFromString("x4")); final Geometry geometry = Geometry.createFromString("1x4"); assertNotNull(geometry); assertEquals(1, geometry.getRows()); assertEquals(4, geometry.getColumns()); + fail = true; try { Geometry.createFromString("0x4"); - fail("0 row not possible."); } catch (AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); } } \ No newline at end of file diff --git a/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/HCSImageFormattedDataTest.java b/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/HCSImageFormattedDataTest.java index 9f65885fb73b24e22b41354be46835cec4f41ea4..2ad1ff093cfc757b5ccee5c9d59edee03ac249e4 100644 --- a/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/HCSImageFormattedDataTest.java +++ b/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/HCSImageFormattedDataTest.java @@ -158,14 +158,15 @@ public class HCSImageFormattedDataTest extends AbstractFileSystemTestCase @Test public final void testCreateWellFileName() { + boolean fail = true; try { HCSImageFormattedData.createWellFileName(null); - fail("Location can not be null."); - } catch (final AssertionError ex) + } catch (AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); final Location location = WELL_LOCATION; final String expected = "row2_column1.tiff"; assertEquals(expected, HCSImageFormattedData.createWellFileName(location)); diff --git a/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/LocationTest.java b/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/LocationTest.java index 7854fb14ce0052f2edf4a3c54596bb89549b4424..a95002aad9c245fc69c8613583d38c113166c155 100644 --- a/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/LocationTest.java +++ b/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/LocationTest.java @@ -16,8 +16,11 @@ package ch.systemsx.cisd.bds.hcs; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertNull; + import org.testng.annotations.Test; -import static org.testng.AssertJUnit.*; /** * Test cases for corresponding {@link Location} class. @@ -30,30 +33,33 @@ public final class LocationTest @Test public final void testConstructor() { + boolean fail = true; try { new Location(-1, 0); - fail("Wrong parameters."); - } catch (AssertionError e) + } catch (AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); + fail = true; try { new Location(1, 0); - fail("Wrong parameters."); - } catch (AssertionError e) + } catch (AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); + fail = true; try { new Location(0, 1); - fail("Wrong parameters."); - } catch (AssertionError e) + } catch (AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); } @Test @@ -69,39 +75,34 @@ public final class LocationTest public final void testCreateLocationFromPosition() { final Geometry geometry = new Geometry(4, 5); + boolean fail = true; try { Location.tryCreateLocationFromPosition(1, null); - fail("Null geometry not allowed."); } catch (AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); assertEquals(new Location(2, 3), Location.tryCreateLocationFromPosition(12, geometry)); assertEquals(new Location(5, 3), Location.tryCreateLocationFromPosition(15, geometry)); assertEquals(new Location(2, 1), Location.tryCreateLocationFromPosition(2, geometry)); assertEquals(new Location(1, 2), Location.tryCreateLocationFromPosition(6, geometry)); - try - { - Location.tryCreateLocationFromPosition(100, geometry); - fail("Position is out of range."); - } catch (AssertionError ex) - { - // Nothing to do here. - } + assertNull(Location.tryCreateLocationFromPosition(100, geometry)); } @Test public final void testCreateLocationFromMatrixCoordinate() { + boolean fail = true; try { Location.tryCreateLocationFromMatrixCoordinate(null); - fail("Coordinate can not be null."); } catch (AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); assertNull(Location.tryCreateLocationFromMatrixCoordinate("")); assertNull(Location.tryCreateLocationFromMatrixCoordinate("8")); assertNull(Location.tryCreateLocationFromMatrixCoordinate("M")); diff --git a/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/PlateGeometryTest.java b/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/PlateGeometryTest.java index 4bd1ee2702e336c35dbf377fff2aeffa6eeda1e5..7bddddf15cd1175c2b6c45d0784b1a727b012a80 100644 --- a/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/PlateGeometryTest.java +++ b/bds/sourceTest/java/ch/systemsx/cisd/bds/hcs/PlateGeometryTest.java @@ -18,8 +18,8 @@ package ch.systemsx.cisd.bds.hcs; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.*; import java.io.File; @@ -43,14 +43,15 @@ public final class PlateGeometryTest extends AbstractFileSystemTestCase @Test public final void testConstructor() { + boolean fail = true; try { new PlateGeometry(-1, 0); - fail("Rows and columns must be > 0."); } catch (AssertionError ex) { - // Nothing to do here. + fail = false; } + assertEquals(false, fail); } @Test diff --git a/bds/sourceTest/java/ch/systemsx/cisd/bds/storage/NodeFiltersTest.java b/bds/sourceTest/java/ch/systemsx/cisd/bds/storage/NodeFiltersTest.java index 5fd57433060e1bdaa75049ee37d235322ad5cbff..032e5a865f3c22afcb4c3575c4599d30b756fca4 100644 --- a/bds/sourceTest/java/ch/systemsx/cisd/bds/storage/NodeFiltersTest.java +++ b/bds/sourceTest/java/ch/systemsx/cisd/bds/storage/NodeFiltersTest.java @@ -16,7 +16,9 @@ package ch.systemsx.cisd.bds.storage; -import static org.testng.AssertJUnit.*; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertTrue; import java.io.File; import java.io.IOException; @@ -45,13 +47,15 @@ public class NodeFiltersTest extends AbstractFileSystemTestCase @Test public final void testExtensionNodeFilterWithNull() { + boolean fail = true; try { - NodeFilters.createExtensionNodeFilter(true, (String) null); - fail("Null extension not accepted."); + NodeFilters.createExtensionNodeFilter(true, (String[]) null); } catch (AssertionError ex) { + fail = false; } + assertEquals(false, fail); } @Test