// Path: src/main/java/com/pablissimo/sonar/model/TsLintRule.java
// public class TsLintRule {
//     public final String key;
//     public final String name;
//     public final String severity;
//     public final String htmlDescription;
// 
//     public final boolean hasDebtRemediation;
//     public final DebtRemediationFunction.Type debtRemediationFunction;
//     public final String debtRemediationScalar;
//     public final String debtRemediationOffset;
//     public final String debtType;
// 
//     public TsLintRule(
//         String key,
//         String severity,
//         String name,
//         String htmlDescription
//     ) {
//         this.key = key;
//         this.severity = severity;
//         this.name = name;
//         this.htmlDescription = htmlDescription;
//         
//         this.hasDebtRemediation = false;
//         this.debtRemediationFunction = DebtRemediationFunction.Type.CONSTANT_ISSUE;
//         this.debtRemediationScalar = "0min";
//         this.debtRemediationOffset = "0min";
//         this.debtType = null;
//     }
// 
//     public TsLintRule(
//         String key,
//         String severity,
//         String name,
//         String htmlDescription,
//         DebtRemediationFunction.Type debtRemediationFunction,
//         String debtRemediationScalar,
//         String debtRemediationOffset,
//         String debtType
//     ) {
//         this.key = key;
//         this.severity = severity;
//         this.name = name;
//         this.htmlDescription = htmlDescription;
// 
//         this.hasDebtRemediation = true;
//         this.debtRemediationFunction = debtRemediationFunction;
//         this.debtRemediationScalar = debtRemediationScalar;
//         this.debtRemediationOffset = debtRemediationOffset;
//         this.debtType = debtType;
//     }
// }


import com.pablissimo.sonar.model.TsLintRule;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.config.Settings;
import org.sonar.api.rule.Severity;
import org.sonar.api.rules.RuleType;
import org.sonar.api.server.debt.DebtRemediationFunction;
import org.sonar.api.server.rule.RulesDefinition.Context;
import org.sonar.api.server.rule.RulesDefinition.Rule;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.*;
        assertEquals(null, rule4.debtRemediationFunction().baseEffort());
        assertEquals(RuleType.BUG, rule4.type());

        // cfg5
        Rule rule5 = getRule("custom-rule-5");
        assertNotNull(rule5);
        assertEquals("test rule #5", rule5.name());
        assertEquals(Severity.MAJOR, rule5.severity());
        assertEquals("#5 description", rule5.htmlDescription());
        assertEquals(RuleType.VULNERABILITY, rule5.type());

        assertEquals("30min", rule5.debtRemediationFunction().gapMultiplier());
        assertEquals("15min", rule5.debtRemediationFunction().baseEffort());
    }

    @Test
    public void LoadRulesFromInvalidStream() throws IOException {
        List<TsLintRule> rules = new ArrayList<>();
        InputStream testStream = new InputStream() {
            @Override
            public int read() throws IOException {
                throw new IOException("Test exception");
            }
        };
        TsRulesDefinition.loadRules(testStream, rules);
    }

    @Test
    public void CheckAdditionalRulesConfigProvided() {
        TsRulesDefinition rulesDef = new TsRulesDefinition(this.settings);
// Path: src/main/java/com/pablissimo/sonar/model/TsLintRule.java
// public class TsLintRule {
//     public final String key;
//     public final String name;
//     public final String severity;
//     public final String htmlDescription;
// 
//     public final boolean hasDebtRemediation;
//     public final DebtRemediationFunction.Type debtRemediationFunction;
//     public final String debtRemediationScalar;
//     public final String debtRemediationOffset;
//     public final String debtType;
// 
//     public TsLintRule(
//         String key,
//         String severity,
//         String name,
//         String htmlDescription
//     ) {
//         this.key = key;
//         this.severity = severity;
//         this.name = name;
//         this.htmlDescription = htmlDescription;
//         
//         this.hasDebtRemediation = false;
//         this.debtRemediationFunction = DebtRemediationFunction.Type.CONSTANT_ISSUE;
//         this.debtRemediationScalar = "0min";
//         this.debtRemediationOffset = "0min";
//         this.debtType = null;
//     }
// 
//     public TsLintRule(
//         String key,
//         String severity,
//         String name,
//         String htmlDescription,
//         DebtRemediationFunction.Type debtRemediationFunction,
//         String debtRemediationScalar,
//         String debtRemediationOffset,
//         String debtType
//     ) {
//         this.key = key;
//         this.severity = severity;
//         this.name = name;
//         this.htmlDescription = htmlDescription;
// 
//         this.hasDebtRemediation = true;
//         this.debtRemediationFunction = debtRemediationFunction;
//         this.debtRemediationScalar = debtRemediationScalar;
//         this.debtRemediationOffset = debtRemediationOffset;
//         this.debtType = debtType;
//     }
// }


// Path: src/test/java/com/pablissimo/sonar/TsRulesDefinitionTest.java
import com.pablissimo.sonar.model.TsLintRule;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.config.Settings;
import org.sonar.api.rule.Severity;
import org.sonar.api.rules.RuleType;
import org.sonar.api.server.debt.DebtRemediationFunction;
import org.sonar.api.server.rule.RulesDefinition.Context;
import org.sonar.api.server.rule.RulesDefinition.Rule;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.*;

        assertEquals(null, rule4.debtRemediationFunction().baseEffort());
        assertEquals(RuleType.BUG, rule4.type());

        // cfg5
        Rule rule5 = getRule("custom-rule-5");
        assertNotNull(rule5);
        assertEquals("test rule #5", rule5.name());
        assertEquals(Severity.MAJOR, rule5.severity());
        assertEquals("#5 description", rule5.htmlDescription());
        assertEquals(RuleType.VULNERABILITY, rule5.type());

        assertEquals("30min", rule5.debtRemediationFunction().gapMultiplier());
        assertEquals("15min", rule5.debtRemediationFunction().baseEffort());
    }

    @Test
    public void LoadRulesFromInvalidStream() throws IOException {
        List<TsLintRule> rules = new ArrayList<>();
        InputStream testStream = new InputStream() {
            @Override
            public int read() throws IOException {
                throw new IOException("Test exception");
            }
        };
        TsRulesDefinition.loadRules(testStream, rules);
    }

    @Test
    public void CheckAdditionalRulesConfigProvided() {
        TsRulesDefinition rulesDef = new TsRulesDefinition(this.settings);
        List<TsLintRule> rules = rulesDef.getRules();