Skip to content

Commit

Permalink
QTS-5 Unit test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
colinduplantis committed Jan 15, 2024
1 parent b745351 commit 245ac92
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class CloseableLockTest
public void testCreate()
throws Exception
{
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run()
throws Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void logSetup() throws Exception {
public void forValue() throws Exception {
final DynamicInstrumentFunctionSelector<FieldMap,InstrumentFromMessage> selector = InstrumentFromMessage.SELECTOR;
//null value
new ExpectedFailure<IllegalArgumentException>("value"){
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
selector.forValue(null);
Expand Down Expand Up @@ -101,7 +101,7 @@ protected void run() throws Exception {
*/
@Test
public void constructor() throws Exception {
new ExpectedFailure<IllegalArgumentException>("class"){
new ExpectedFailure<NullPointerException>() {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void run() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class StaticInstrumentFunctionSelectorTest {
@SuppressWarnings("rawtypes")
public void forInstrument() throws Exception {
final StaticInstrumentFunctionSelector<InstrumentToMessage> selector = InstrumentToMessage.SELECTOR;
new ExpectedFailure<IllegalArgumentException>("instrument"){
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
selector.forInstrument(null);
Expand All @@ -60,7 +60,7 @@ protected void run() throws Exception {
@Test
@SuppressWarnings("rawtypes")
public void constructor() throws Exception {
new ExpectedFailure<IllegalArgumentException>("class"){
new ExpectedFailure<NullPointerException>() {
@Override
@SuppressWarnings("unchecked")
protected void run() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected List<PositionKey<?>> createDifferentFixtures() {

@Test
public void testNullInstrument() throws Exception {
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new PositionKeyImpl<Equity>(null, "abc", "abc");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ public void constructor() throws Exception {
"4.5", "14", null, "-52", "18", "97")));
createAndAssert(list, "1", "9.5", "18", null, "-50", "19", "104");

new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new SummaryRowUpdater(null);
}
};

new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new SummaryRowUpdater(new PositionRowImpl(null, null, null, null, BigDecimal.ZERO));
Expand Down
14 changes: 4 additions & 10 deletions core/src/test/java/org/marketcetera/module/DataFlowTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -706,18 +706,15 @@ public void createFlowModuleFailures() throws Exception {
ProcessorModuleFactory.PROVIDER_URN);
assertFalse(urns.toString(), urns.contains(procURN));
//test various emitter module failures: parm value
new ExpectedFailure<IllegalRequestParameterValue>(
Messages.ILLEGAL_REQ_PARM_VALUE,
EmitterModuleFactory.INSTANCE_URN.getValue(),
null) {
new ExpectedFailure<IllegalRequestParameterValue>() {
protected void run() throws Exception {
sManager.createDataFlow(new DataRequest[]{
new DataRequest(EmitterModuleFactory.INSTANCE_URN),
new DataRequest(procURN,String.class.getName())});
}
};
//verify that when a request to initate data flow fails any module
//that had sucessfully initiated requests have their requests
//verify that when a request to initiate data flow fails any module
//that had successfully initiated requests have their requests
//canceled. In this case the processor module should have its
//request canceled.
ProcessorModule proc = (ProcessorModule) ModuleBase.getInstance(procURN);
Expand All @@ -736,10 +733,7 @@ protected void run() throws Exception {
};

//test processor module failures
new ExpectedFailure<IllegalRequestParameterValue>(
Messages.ILLEGAL_REQ_PARM_VALUE,
procURN.getValue(),
null) {
new ExpectedFailure<IllegalRequestParameterValue>() {
protected void run() throws Exception {
sManager.createDataFlow(new DataRequest[]{
new DataRequest(EmitterModuleFactory.INSTANCE_URN,
Expand Down
12 changes: 6 additions & 6 deletions core/src/test/java/org/marketcetera/trade/CurrencyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ protected SecurityType getSecurityType() {

@Test
public void testNullSymbol() throws Exception {
new ExpectedFailure<IllegalArgumentException>(Messages.MISSING_LEFT_CURRENCY.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Currency(null, "INR", "1D","2W");
}
};
new ExpectedFailure<IllegalArgumentException>(Messages.MISSING_RIGHT_CURRENCY.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Currency("INR", null, "1D","2W");
Expand All @@ -66,25 +66,25 @@ protected void run() throws Exception {
public void testWhitespaceSymbol()
throws Exception
{
new ExpectedFailure<IllegalArgumentException>(Messages.MISSING_RIGHT_CURRENCY.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Currency("INR", "", "1D","2W");
}
};
new ExpectedFailure<IllegalArgumentException>(Messages.MISSING_RIGHT_CURRENCY.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Currency("INR", " ", "1D","2W");
}
};
new ExpectedFailure<IllegalArgumentException>(Messages.MISSING_LEFT_CURRENCY.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Currency("", "INR", "1D","2W");
}
};
new ExpectedFailure<IllegalArgumentException>(Messages.MISSING_LEFT_CURRENCY.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Currency(" ", "INR", "1D","2W");
Expand Down
6 changes: 3 additions & 3 deletions core/src/test/java/org/marketcetera/trade/EquityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected SecurityType getSecurityType() {

@Test
public void testNullSymbol() throws Exception {
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Equity(null);
Expand All @@ -55,13 +55,13 @@ protected void run() throws Exception {

@Test
public void testWhitespaceSymbol() throws Exception {
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Equity("");
}
};
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Equity(" \n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,39 @@ protected void run()
FutureExpirationMonth.getFutureExpirationMonth(null);
}
};
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run()
throws Exception
{
FutureExpirationMonth.getFutureExpirationMonth(' ');
}
};
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run()
throws Exception
{
FutureExpirationMonth.getFutureExpirationMonth("");
}
};
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run()
throws Exception
{
FutureExpirationMonth.getFutureExpirationMonth(" ");
}
};
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run()
throws Exception
{
FutureExpirationMonth.getFutureExpirationMonth('E');
}
};
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run()
throws Exception
Expand Down
22 changes: 11 additions & 11 deletions core/src/test/java/org/marketcetera/trade/FutureTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ protected SecurityType getSecurityType() {

@Test
public void testNullSymbol() throws Exception {
new ExpectedFailure<IllegalArgumentException>(Messages.NULL_SYMBOL.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Future(null, FutureExpirationMonth.JULY, 18);
}
};
new ExpectedFailure<IllegalArgumentException>(Messages.NULL_SYMBOL.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Future(null, "201010");
Expand All @@ -74,19 +74,19 @@ protected void run() throws Exception {
public void testWhitespaceSymbol()
throws Exception
{
new ExpectedFailure<IllegalArgumentException>(Messages.NULL_SYMBOL.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Future("",FutureExpirationMonth.JULY, 18);
}
};
new ExpectedFailure<IllegalArgumentException>(Messages.NULL_SYMBOL.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Future(" ",FutureExpirationMonth.JULY, 18);
}
};
new ExpectedFailure<IllegalArgumentException>(Messages.NULL_SYMBOL.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Future(" ", "201012");
Expand All @@ -102,7 +102,7 @@ protected void run() throws Exception {
public void testNullExpirationMonth()
throws Exception
{
new ExpectedFailure<IllegalArgumentException>(Messages.NULL_MONTH.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Future("ABC", null, 18);
Expand Down Expand Up @@ -193,14 +193,14 @@ protected void run()
}
@Test
public void testInvalidExpiry() throws Exception {
new ExpectedFailure<IllegalArgumentException>(Messages.NULL_EXPIRY.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Future("ABC",
null);
}
};
new ExpectedFailure<IllegalArgumentException>(Messages.NULL_EXPIRY.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Future("ABC",
Expand Down Expand Up @@ -273,23 +273,23 @@ public void testExpiryParsing()
public void testFromString()
throws Exception
{
new ExpectedFailure<IllegalArgumentException>(Messages.NULL_SYMBOL.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run()
throws Exception
{
Future.fromString(null);
}
};
new ExpectedFailure<IllegalArgumentException>(Messages.NULL_SYMBOL.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run()
throws Exception
{
Future.fromString("");
}
};
new ExpectedFailure<IllegalArgumentException>(Messages.NULL_SYMBOL.getText()) {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run()
throws Exception
Expand Down
18 changes: 9 additions & 9 deletions core/src/test/java/org/marketcetera/trade/OptionTest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.marketcetera.trade;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

import java.math.BigDecimal;
import java.util.List;
Expand Down Expand Up @@ -75,7 +75,7 @@ private void verifyStrikePriceTrimTrailingZero(String inPrice1, String inPrice2)

@Test
public void testNullSymbol() throws Exception {
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Option(null, "20091010", BigDecimal.ONE, OptionType.Call);
Expand All @@ -85,13 +85,13 @@ protected void run() throws Exception {

@Test
public void testWhitespaceSymbol() throws Exception {
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Option("", "20091010", BigDecimal.ONE, OptionType.Call);
}
};
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Option(" ", "20091010", BigDecimal.ONE, OptionType.Call);
Expand All @@ -101,7 +101,7 @@ protected void run() throws Exception {

@Test
public void testNullType() throws Exception {
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Option("ABC", "20091010", BigDecimal.ONE, null);
Expand All @@ -111,7 +111,7 @@ protected void run() throws Exception {

@Test
public void testNullExpiry() throws Exception {
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Option("ABC", null, BigDecimal.ONE, OptionType.Call);
Expand All @@ -121,13 +121,13 @@ protected void run() throws Exception {

@Test
public void testWhitespaceExpiry() throws Exception {
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Option("ABC", "", BigDecimal.ONE, OptionType.Call);
}
};
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Option("ABC", " ", BigDecimal.ONE, OptionType.Call);
Expand All @@ -137,7 +137,7 @@ protected void run() throws Exception {

@Test
public void testNullStrikePrice() throws Exception {
new ExpectedFailure<IllegalArgumentException>() {
new ExpectedFailure<NullPointerException>() {
@Override
protected void run() throws Exception {
new Option("ABC", "20091010", null, OptionType.Call);
Expand Down
Loading

0 comments on commit 245ac92

Please sign in to comment.