From f97f29ed985bc83c94d8aabc38b9e66c585e0691 Mon Sep 17 00:00:00 2001 From: Patrick Austin Date: Fri, 21 Oct 2022 16:02:13 +0100 Subject: [PATCH] Use assertNull in tests #19 --- .../org/icatproject/utils/TestIcatUnits.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/icatproject/utils/TestIcatUnits.java b/src/test/java/org/icatproject/utils/TestIcatUnits.java index 3384573..cff8070 100644 --- a/src/test/java/org/icatproject/utils/TestIcatUnits.java +++ b/src/test/java/org/icatproject/utils/TestIcatUnits.java @@ -1,6 +1,8 @@ package org.icatproject.utils; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + import org.icatproject.utils.IcatUnits.SystemValue; import org.junit.Test; @@ -10,13 +12,13 @@ public void testArguments() { // Both null IcatUnits icatUnits = new IcatUnits(); SystemValue systemValue = icatUnits.new SystemValue(null, "impossible to parse"); - assertEquals(null, systemValue.units); - assertEquals(null, systemValue.value); + assertNull(systemValue.units); + assertNull(systemValue.value); // Unit parsed, value null systemValue = icatUnits.new SystemValue(null, "K"); assertEquals("Kelvin", systemValue.units); - assertEquals(null, systemValue.value); + assertNull(systemValue.value); // Unit parsed, value converted systemValue = icatUnits.new SystemValue(1., "GK"); @@ -28,15 +30,16 @@ public void testArguments() { public void testAliasing() { IcatUnits icatUnits = new IcatUnits(); SystemValue systemValue = icatUnits.new SystemValue(null, "celsius"); - assertEquals(null, systemValue.units); + assertNull(systemValue.units); systemValue = icatUnits.new SystemValue(null, "degC"); - assertEquals(null, systemValue.units); + assertNull(systemValue.units); systemValue = icatUnits.new SystemValue(null, "kelvin"); - assertEquals(null, systemValue.units); + assertNull(systemValue.units); systemValue = icatUnits.new SystemValue(null, "eV"); - assertEquals(null, systemValue.units); + assertNull(systemValue.units); - icatUnits = new IcatUnits("\u2103: celsius, degC; K: kelvin; J: eV 1.602176634e-19"); + new IcatUnits("\u2103: celsius, degC; K: kelvin; J: eV 1.602176634e-19"); + new IcatUnits(); systemValue = icatUnits.new SystemValue(null, "celsius"); assertEquals("Kelvin", systemValue.units); systemValue = icatUnits.new SystemValue(null, "degC");