Skip to content
4 changes: 4 additions & 0 deletions .env-setup-temp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"
./mvnw clean verify -Dmaven.test.skip=false -B
4 changes: 4 additions & 0 deletions .env-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -e
cd /workspaces/quickfixj
./mvnw -B clean verify
17 changes: 11 additions & 6 deletions quickfixj-base/src/test/java/quickfix/DayConverterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,26 @@

import java.util.Locale;

import junit.framework.TestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

public class DayConverterTest extends TestCase {
public class DayConverterTest {
private Locale defaultLocale;

protected void setUp() throws Exception {
super.setUp();
@Before
public void setUp() throws Exception {
defaultLocale = Locale.getDefault();
Locale.setDefault(Locale.US);
}

protected void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
Locale.setDefault(defaultLocale);
super.tearDown();
}

@Test
public void testConversionToInt() throws Exception {
assertEquals(1, DayConverter.toInteger("sU"));
assertEquals(4, DayConverter.toInteger("WEDnes"));
Expand All @@ -54,6 +58,7 @@ public void testConversionToInt() throws Exception {
assertEquals(2, DayConverter.toInteger("Mo"));
}

@Test
public void testConversionToString() throws Exception {
Locale.setDefault(Locale.US);
assertEquals("sunday", DayConverter.toString(1));
Expand Down
33 changes: 27 additions & 6 deletions quickfixj-base/src/test/java/quickfix/DictionaryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,28 @@

import java.util.Locale;

import junit.framework.TestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

public class DictionaryTest extends TestCase {
public class DictionaryTest {
private Dictionary dictionary;
private Locale defaultLocale;

protected void setUp() throws Exception {
super.setUp();
@Before
public void setUp() throws Exception {
dictionary = new Dictionary();
defaultLocale = Locale.getDefault();
Locale.setDefault(Locale.US);
}

protected void tearDown() throws Exception {
super.tearDown();
@After
public void tearDown() throws Exception {
Locale.setDefault(defaultLocale);
}

@Test
public void testDay() throws Exception {
assertFalse(dictionary.has("DAY"));
dictionary.setString("DAY", "monday");
Expand All @@ -52,6 +56,7 @@ public void testDay() throws Exception {
assertEquals(4, dictionary.getDay("DAY"));
}

@Test
public void testDayTooShort() throws Exception {
dictionary.setString("DAY", "t");
try {
Expand All @@ -61,6 +66,7 @@ public void testDayTooShort() throws Exception {
}
}

@Test
public void testDayTooUnknown() throws Exception {
dictionary.setString("DAY", "xyz");
try {
Expand All @@ -70,6 +76,7 @@ public void testDayTooUnknown() throws Exception {
}
}

@Test
public void testBoolean() throws Exception {
dictionary.setBool("B", true);
assertTrue(dictionary.getBool("B"));
Expand All @@ -78,6 +85,7 @@ public void testBoolean() throws Exception {
assertFalse(dictionary.getBool("B"));
}

@Test
public void testBooleanError() throws Exception {
dictionary.setString("B", "XYZ");
try {
Expand All @@ -87,6 +95,7 @@ public void testBooleanError() throws Exception {
}
}

@Test
public void testBooleanMissing() throws Exception {
try {
dictionary.getBool("B");
Expand All @@ -95,11 +104,13 @@ public void testBooleanMissing() throws Exception {
}
}

@Test
public void testString() throws Exception {
dictionary.setString("B", "X");
assertEquals("X", dictionary.getString("B"));
}

@Test
public void testStringMissing() throws Exception {
try {
dictionary.getString("X");
Expand All @@ -108,11 +119,13 @@ public void testStringMissing() throws Exception {
}
}

@Test
public void testDouble() throws Exception {
dictionary.setDouble("B", 1.1);
assertEquals(1.1, dictionary.getDouble("B"), 0);
}

@Test
public void testDoubleError() throws Exception {
dictionary.setString("B", "XYZ");
try {
Expand All @@ -122,6 +135,7 @@ public void testDoubleError() throws Exception {
}
}

@Test
public void testDoubleMissing() throws Exception {
try {
dictionary.getDouble("B");
Expand All @@ -130,11 +144,13 @@ public void testDoubleMissing() throws Exception {
}
}

@Test
public void testLong() throws Exception {
dictionary.setLong("B", 1);
assertEquals(1, dictionary.getLong("B"));
}

@Test
public void testLongError() throws Exception {
dictionary.setString("B", "XYZ");
try {
Expand All @@ -144,6 +160,7 @@ public void testLongError() throws Exception {
}
}

@Test
public void testLongMissing() throws Exception {
try {
dictionary.getLong("B");
Expand All @@ -152,6 +169,7 @@ public void testLongMissing() throws Exception {
}
}

@Test
public void testMerge() throws Exception {
Dictionary d2 = new Dictionary("ABC");
d2.setString("XYZ", "123");
Expand All @@ -166,13 +184,15 @@ public void testMerge() throws Exception {
assertEquals(1, d2.toMap().size());
}

@Test
public void testName() throws Exception {
assertNull(dictionary.getName());

Dictionary d = new Dictionary("NAME");
assertEquals("NAME", d.getName());
}

@Test
public void testConstructors() throws Exception {
Dictionary dw = new Dictionary();
assertNull(dw.getName());
Expand All @@ -194,6 +214,7 @@ public void testConstructors() throws Exception {
}

// From C++ tests
@Test
public void testGetDay() throws Exception {
Dictionary object = new Dictionary();

Expand Down
11 changes: 8 additions & 3 deletions quickfixj-base/src/test/java/quickfix/ExceptionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,30 @@

package quickfix;

import junit.framework.TestCase;
import org.junit.Test;
import static org.junit.Assert.*;

public class ExceptionTest extends TestCase {
public class ExceptionTest {

@Test
public void testDoNotSend() {
new DoNotSend();
}

@Test
public void testIncorrectDataFormat() {
IncorrectDataFormat e = new IncorrectDataFormat(5, "test");
assertEquals(5, e.getField());
assertEquals("test", e.getData());
}

@Test
public void testIncorrectTagValue() {
new IncorrectTagValue(5);
IncorrectTagValue e = new IncorrectTagValue(5, "test");
new IncorrectTagValue(5, "test");
}

@Test
public void testRuntimeError() {
new RuntimeError();
new RuntimeError("test");
Expand Down
Loading
Loading