use of tech.cassandre.trading.bot.util.exception.ConfigurationException in project cassandre-trading-bot by cassandre-tech.
the class CassandreStrategiesAutoConfigurationTest method checkNoStrategyFound.
@Test
@DisplayName("Check error messages when no strategy is found")
public void checkNoStrategyFound() {
try {
System.setProperty(PARAMETER_INVALID_STRATEGY_ENABLED, "false");
System.setProperty(PARAMETER_TESTABLE_STRATEGY_ENABLED, "false");
System.setProperty(PARAMETER_TESTABLE_TA4J_STRATEGY_ENABLED, "false");
System.setProperty(PARAMETER_NO_TRADING_ACCOUNT_STRATEGY_ENABLED, "false");
System.setProperty(PARAMETER_LARGE_TESTABLE_STRATEGY_ENABLED, "false");
System.setProperty(PARAMETER_STRATEGY_1_ENABLED, "false");
System.setProperty(PARAMETER_STRATEGY_2_ENABLED, "false");
System.setProperty(PARAMETER_STRATEGY_3_ENABLED, "false");
SpringApplication application = new SpringApplication(CassandreTradingBot.class);
application.run();
fail("Exception not raised");
} catch (Exception e) {
assertTrue(e.getCause() instanceof ConfigurationException);
assertTrue(e.getCause().getMessage().contains("No strategy found"));
}
}
use of tech.cassandre.trading.bot.util.exception.ConfigurationException in project cassandre-trading-bot by cassandre-tech.
the class CassandreStrategiesAutoConfigurationTest method checkStrategyWithInvalidTradeAccount.
@Test
@DisplayName("Check error messages if a strategy has an invalid trade account")
public void checkStrategyWithInvalidTradeAccount() {
try {
System.setProperty(PARAMETER_INVALID_STRATEGY_ENABLED, "false");
System.setProperty(PARAMETER_TESTABLE_STRATEGY_ENABLED, "false");
System.setProperty(PARAMETER_TESTABLE_TA4J_STRATEGY_ENABLED, "false");
System.setProperty(PARAMETER_LARGE_TESTABLE_STRATEGY_ENABLED, "false");
System.setProperty(PARAMETER_NO_TRADING_ACCOUNT_STRATEGY_ENABLED, "true");
System.setProperty(PARAMETER_STRATEGY_1_ENABLED, "true");
System.setProperty(PARAMETER_STRATEGY_2_ENABLED, "true");
System.setProperty(PARAMETER_STRATEGY_3_ENABLED, "true");
SpringApplication application = new SpringApplication(CassandreTradingBot.class);
application.run();
fail("Exception not raised");
} catch (Exception e) {
assertTrue(e.getCause() instanceof ConfigurationException);
assertTrue(e.getCause().getMessage().contains("Your strategies specify a trading account that doesn't exist"));
}
}
use of tech.cassandre.trading.bot.util.exception.ConfigurationException in project cassandre-trading-bot by cassandre-tech.
the class IdDuplicatedTest method checkErrorMessages.
@Test
@DisplayName("Check error messages")
public void checkErrorMessages() {
try {
SpringApplication application = new SpringApplication(CassandreTradingBot.class);
application.run();
fail("Exception not raised");
} catch (Exception e) {
assertTrue(e.getCause() instanceof ConfigurationException);
assertTrue(e.getCause().getMessage().contains("You have duplicated strategy ids"));
}
}
use of tech.cassandre.trading.bot.util.exception.ConfigurationException in project cassandre-trading-bot by cassandre-tech.
the class InvalidTradeAccountTest method checkErrorMessages.
@Test
@DisplayName("Check error messages")
public void checkErrorMessages() {
try {
SpringApplication application = new SpringApplication(CassandreTradingBot.class);
application.run();
fail("Exception not raised");
} catch (Exception e) {
assertTrue(e.getCause() instanceof ConfigurationException);
assertTrue(e.getCause().getMessage().contains("Your strategies specify a trading account that doesn't exist"));
}
}
use of tech.cassandre.trading.bot.util.exception.ConfigurationException in project cassandre-trading-bot by cassandre-tech.
the class NoStrategyTest method checkErrorMessages.
@Test
@DisplayName("Check error messages")
public void checkErrorMessages() {
try {
SpringApplication application = new SpringApplication(CassandreTradingBot.class);
application.run();
fail("Exception not raised");
} catch (Exception e) {
assertTrue(e.getCause() instanceof ConfigurationException);
assertTrue(e.getCause().getMessage().contains("No strategy found"));
}
}
Aggregations