package com.ruoyi.web.modules.trading.support;

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

import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.web.modules.trading.domain.BizIsolationSetting;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

@DisplayName("IsolationSettingValidation")
class IsolationSettingValidationTest
{

    @Test
    @DisplayName("默认天数范围")
    void defaultDays()
    {
        BizIsolationSetting row = new BizIsolationSetting();
        row.setDefaultDays(0);
        assertThrows(ServiceException.class, () -> IsolationSettingValidation.validateRowForSave(row));
        row.setDefaultDays(3651);
        assertThrows(ServiceException.class, () -> IsolationSettingValidation.validateRowForSave(row));
        row.setDefaultDays(7);
        IsolationSettingValidation.validateRowForSave(row);
        assertEquals(IsolationPenRules.SETTING_SINGLETON_ID, row.getId());
    }
}
