Search in sources :

Example 1 with ConfigurationException

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"));
    }
}
Also used : ConfigurationException(tech.cassandre.trading.bot.util.exception.ConfigurationException) SpringApplication(org.springframework.boot.SpringApplication) ConfigurationException(tech.cassandre.trading.bot.util.exception.ConfigurationException) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 2 with ConfigurationException

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"));
    }
}
Also used : ConfigurationException(tech.cassandre.trading.bot.util.exception.ConfigurationException) SpringApplication(org.springframework.boot.SpringApplication) ConfigurationException(tech.cassandre.trading.bot.util.exception.ConfigurationException) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 3 with ConfigurationException

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"));
    }
}
Also used : ConfigurationException(tech.cassandre.trading.bot.util.exception.ConfigurationException) SpringApplication(org.springframework.boot.SpringApplication) ConfigurationException(tech.cassandre.trading.bot.util.exception.ConfigurationException) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 4 with ConfigurationException

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"));
    }
}
Also used : ConfigurationException(tech.cassandre.trading.bot.util.exception.ConfigurationException) SpringApplication(org.springframework.boot.SpringApplication) ConfigurationException(tech.cassandre.trading.bot.util.exception.ConfigurationException) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 5 with ConfigurationException

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"));
    }
}
Also used : ConfigurationException(tech.cassandre.trading.bot.util.exception.ConfigurationException) SpringApplication(org.springframework.boot.SpringApplication) ConfigurationException(tech.cassandre.trading.bot.util.exception.ConfigurationException) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

ConfigurationException (tech.cassandre.trading.bot.util.exception.ConfigurationException)9 DisplayName (org.junit.jupiter.api.DisplayName)8 Test (org.junit.jupiter.api.Test)8 SpringApplication (org.springframework.boot.SpringApplication)8 IOException (java.io.IOException)1 PostConstruct (javax.annotation.PostConstruct)1 ExchangeSpecification (org.knowm.xchange.ExchangeSpecification)1 HttpStatusIOException (si.mazi.rescu.HttpStatusIOException)1