Skip to content
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
7 changes: 3 additions & 4 deletions quickfixj-base/src/test/java/quickfix/SessionIDTest.java
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jetbrains-junie you did not add any @Test annotations in this class. Please fix it.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

package quickfix;

import junit.framework.TestCase;
import org.junit.Test;
import static org.junit.Assert.*;
import quickfix.field.BeginString;
import quickfix.field.SenderCompID;
import quickfix.field.SenderLocationID;
Expand All @@ -28,9 +29,7 @@
import quickfix.field.TargetLocationID;
import quickfix.field.TargetSubID;

import static org.junit.Assert.assertNotEquals;

public class SessionIDTest extends TestCase {
public class SessionIDTest {
public void testAllFieldConstructor() throws Exception {
SessionID sessionID = new SessionID(new BeginString("FIX.4.2"), new SenderCompID("SENDER"),
new SenderSubID("SENDERSUB"), new SenderLocationID("SENDERLOC"), new TargetCompID(
Expand Down
20 changes: 5 additions & 15 deletions quickfixj-core/src/test/java/quickfix/BigDecimalFieldTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@

package quickfix;

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

import java.math.BigDecimal;
import java.lang.reflect.Constructor;
Expand All @@ -32,24 +31,15 @@
/**
* Conditionally test that BigDecimals are handled correctly if we've generated
* the message fields with BigDecimal support
*
* @author toli
* @version $Id$
*/
public class BigDecimalFieldTest extends TestCase {
public BigDecimalFieldTest(String inName) {
super(inName);
}

public static Test suite() {
return new TestSuite(BigDecimalFieldTest.class);
}
public class BigDecimalFieldTest {

/**
* Verify that the round-tripping of BigDecimals works with messages
* Run the real test inside the testcase only if we have a BigDecimal-ized fields,
* ie if we have a constructor taking a BigDecimal.
*/
@Test
public void testBigDecimalRoundTripping() throws Exception {
// check to see if we have a BigDecimal constructor
try {
Expand All @@ -58,7 +48,7 @@ public void testBigDecimalRoundTripping() throws Exception {
BigDecimal originalPrice = new BigDecimal("10.3000");
assertEquals(4, originalPrice.scale());
Message message = new NewOrderSingle();
message.setField(cons.newInstance (new BigDecimal("10.3000")));
message.setField(cons.newInstance(new BigDecimal("10.3000")));
BigDecimal extractedPrice = message.getDecimal(Price.FIELD);
assertEquals(4, extractedPrice.scale());
assertEquals(new BigDecimal("10.3000"), extractedPrice);
Expand Down
5 changes: 3 additions & 2 deletions quickfixj-core/src/test/java/quickfix/CompositeLogTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
package quickfix;

import static org.mockito.Mockito.*;
import junit.framework.TestCase;
import org.junit.Test;

public class CompositeLogTest extends TestCase {
public class CompositeLogTest {
@Test
public void testCompositeLog() throws Exception {
Log mockLog1 = mock(Log.class);
Log mockLog2 = mock(Log.class);
Expand Down
7 changes: 5 additions & 2 deletions quickfixj-core/src/test/java/quickfix/ExceptionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@

package quickfix;

import junit.framework.TestCase;
import org.junit.Test;

public class ExceptionTest extends TestCase {
public class ExceptionTest {

@Test
public void testRejectLogon() {
new RejectLogon();
}

@Test
public void testSessionNotFound() {
new SessionNotFound();
new SessionNotFound("test");
}

@Test
public void testSessionException() {
new SessionException();
new SessionException("test");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
import java.util.Observable;
import java.util.Observer;

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

public class ListenerSupportTest extends TestCase {
public class ListenerSupportTest {
private static class ObserverForTest implements Observer {
public Object arg;

Expand All @@ -33,6 +34,7 @@ public void update(Observable o, Object arg) {
}
}

@Test
public void testMulticasting() throws Exception {
ListenerSupport support = new ListenerSupport(Observer.class);
ObserverForTest observer = new ObserverForTest();
Expand Down
Loading
Loading