From 5687e6ede9c73ebbe521ac23a481e5960d253ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Wed, 3 May 2023 08:23:29 +0200 Subject: [PATCH] chore: fix tests --- .../measurementDevice/pHProbeTest.java | 39 +++++++------------ .../heatExchanger/HeatExchangerTest.java | 15 ++++--- 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/test/java/neqsim/processSimulation/measurementDevice/pHProbeTest.java b/src/test/java/neqsim/processSimulation/measurementDevice/pHProbeTest.java index dfb7bcb780..0fb465cfed 100644 --- a/src/test/java/neqsim/processSimulation/measurementDevice/pHProbeTest.java +++ b/src/test/java/neqsim/processSimulation/measurementDevice/pHProbeTest.java @@ -3,20 +3,21 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import neqsim.processSimulation.processEquipment.stream.Stream; +import neqsim.processSimulation.processEquipment.stream.StreamInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; class pHProbeTest { static Logger logger = LogManager.getLogger(pHProbeTest.class); + static SystemInterface testFluid; + static StreamInterface stream_1; - @BeforeAll - static void setUpBeforeClass() throws Exception {} - - @Test - void testGetMeasuredValue() { + @BeforeEach + void setUp() { SystemInterface testFluid = new SystemSrkCPAstatoil(318.15, 50.0); testFluid.addComponent("nitrogen", 1.205); testFluid.addComponent("CO2", 1.340); @@ -31,10 +32,12 @@ void testGetMeasuredValue() { testFluid.addComponent("water", 141.053); testFluid.setMixingRule(10); testFluid.setMultiPhaseCheck(true); - - Stream stream_1 = new Stream("Stream1", testFluid); + stream_1 = new Stream("Stream1", testFluid); stream_1.run(); + } + @Test + void testGetMeasuredValue() { pHProbe phmeasurement = new pHProbe(stream_1); phmeasurement.run(); logger.info("pH " + phmeasurement.getMeasuredValue()); @@ -43,24 +46,6 @@ void testGetMeasuredValue() { @Test void testGetMeasuredValueWithAlkanility() { - SystemInterface testFluid = new SystemSrkCPAstatoil(318.15, 50.0); - testFluid.addComponent("nitrogen", 1.205); - testFluid.addComponent("CO2", 1.340); - testFluid.addComponent("methane", 87.974); - testFluid.addComponent("ethane", 5.258); - testFluid.addComponent("propane", 3.283); - testFluid.addComponent("i-butane", 0.082); - testFluid.addComponent("n-butane", 0.487); - testFluid.addComponent("i-pentane", 0.056); - testFluid.addComponent("n-pentane", 1.053); - testFluid.addComponent("nC10", 14.053); - testFluid.addComponent("water", 141.053); - testFluid.setMixingRule(10); - testFluid.setMultiPhaseCheck(true); - - Stream stream_1 = new Stream("Stream1", testFluid); - stream_1.run(); - pHProbe phmeasurement = new pHProbe(stream_1); phmeasurement.setAlkanility(50.0); phmeasurement.run(); @@ -68,11 +53,13 @@ void testGetMeasuredValueWithAlkanility() { assertEquals(5.629055432357595, phmeasurement.getMeasuredValue(), 0.01); } + @Disabled @Test void testPHProbe() { // fail("Not yet implemented"); } + @Disabled @Test void testPHProbeStreamInterface() { // fail("Not yet implemented"); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/heatExchanger/HeatExchangerTest.java b/src/test/java/neqsim/processSimulation/processEquipment/heatExchanger/HeatExchangerTest.java index 1756bf835e..0b6def2de3 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/heatExchanger/HeatExchangerTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/heatExchanger/HeatExchangerTest.java @@ -17,14 +17,13 @@ * @version $Id: $Id * @since 2.2.3 */ -public class HeatExchangerTest extends neqsim.NeqSimTest{ +public class HeatExchangerTest extends neqsim.NeqSimTest { static neqsim.thermo.system.SystemInterface testSystem; - static Stream gasStream; + Stream gasStream; @BeforeEach - static void setUp() { - neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 60.0), 20.00); + void setUp() { + testSystem = new neqsim.thermo.system.SystemSrkEos((273.15 + 60.0), 20.00); testSystem.addComponent("methane", 120.00); testSystem.addComponent("ethane", 120.0); testSystem.addComponent("n-heptane", 3.0); @@ -35,9 +34,9 @@ static void setUp() { } @Test - public static void test_Run1(String args[]) { + void testRun1() { Stream stream_Hot = new Stream("Stream1", testSystem); - Stream stream_Cold = new Stream("Stream1", testSystem.clone()); + Stream stream_Cold = new Stream("Stream2", testSystem.clone()); HeatExchanger heatEx = new HeatExchanger("heatEx"); heatEx.setFeedStream(0, stream_Hot); @@ -70,7 +69,7 @@ public static void test_Run1(String args[]) { } @Test - public static void test_Run2(String args[]) { + void testRun2() { Stream stream_Hot = new Stream("Stream1", testSystem); neqsim.thermo.system.SystemInterface testSystem2 =