Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed May 3, 2023
1 parent 8e715d2 commit 5687e6e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
Expand All @@ -43,36 +46,20 @@ 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();
logger.info("pH " + phmeasurement.getMeasuredValue());
assertEquals(5.629055432357595, phmeasurement.getMeasuredValue(), 0.01);
}

@Disabled
@Test
void testPHProbe() {
// fail("Not yet implemented");
}

@Disabled
@Test
void testPHProbeStreamInterface() {
// fail("Not yet implemented");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit 5687e6e

Please sign in to comment.