package de.accso.flexinale;

import de.accso.flexinale.common.application.Config;
import de.accso.flexinale.common.shared_kernel.DoNotCheckInArchitectureTests;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.Assertions.assertThat;

@SpringBootTest(classes = {FlexinaleDistributedApplicationBackoffice.class})
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
@ActiveProfiles("configtest")
@DoNotCheckInArchitectureTests
class FlexinaleDistributedApplicationBackofficeSpringConfigTest {

    @Autowired
    Config config;

    @Test
    void testLoadSpringConfig() {
        // arrange, act
        // nope, is loaded auto-magically by Spring, see application-configtest.properties

        // assert
        assertThat(config.getQuoteOnline()).isEqualTo(33); // default
        assertThat(config.getMinZeitZwischenVorfuehrungenInMinuten()).isEqualTo(30); // default
    }
}
