package at.procon.eventhub.config;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;

import org.junit.jupiter.api.Test;

class EventHubPropertiesTest {

    @Test
    void legalRequirementsBaseUrlIsNormalizedWhenPrefixedWithColonAndWhitespace() {
        EventHubProperties.LegalRequirements legalRequirements = new EventHubProperties.LegalRequirements();

        legalRequirements.setBaseUrl(": https://legalrequirements.services.bytebar.eu/ODataV4/LR/");

        assertEquals("https://legalrequirements.services.bytebar.eu/ODataV4/LR", legalRequirements.getBaseUrl());
    }

    @Test
    void legalRequirementsBaseUrlFallsBackToDefaultWhenBlank() {
        EventHubProperties.LegalRequirements legalRequirements = new EventHubProperties.LegalRequirements();

        legalRequirements.setBaseUrl("   ");

        assertEquals("https://legalrequirements.services.bytebar.eu/ODataV4/LR", legalRequirements.getBaseUrl());
    }

    @Test
    void legalRequirementsResetSessionIsDisabledByDefault() {
        EventHubProperties.LegalRequirements legalRequirements = new EventHubProperties.LegalRequirements();

        assertFalse(legalRequirements.isResetSessionAfterUse());
    }
}
