Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.realtime.protection.configuration.entity.defense.template;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class TemplateTest {
|
||||
|
||||
@Test
|
||||
public void testSetHasProtectLevel() {
|
||||
Template template = new Template();
|
||||
ProtectLevel protectLevel = new ProtectLevel();
|
||||
protectLevel.setHasDNS(true);
|
||||
|
||||
template.setProtectLevelLow(new ProtectLevel());
|
||||
template.setProtectLevelMedium(new ProtectLevel());
|
||||
template.setProtectLevelHigh(new ProtectLevel());
|
||||
|
||||
assertDoesNotThrow(() -> {
|
||||
template.setProtectLevelHigh(protectLevel);
|
||||
template.setHasProtectLevel();
|
||||
assertTrue(template.getHasProtectLevelHigh());
|
||||
assertFalse(template.getHasProtectLevelMedium());
|
||||
assertFalse(template.getHasProtectLevelLow());
|
||||
});
|
||||
|
||||
assertDoesNotThrow(() -> {
|
||||
template.setProtectLevelMedium(protectLevel);
|
||||
template.setProtectLevelHigh(new ProtectLevel());
|
||||
template.setHasProtectLevel();
|
||||
assertFalse(template.getHasProtectLevelHigh());
|
||||
assertTrue(template.getHasProtectLevelMedium());
|
||||
assertFalse(template.getHasProtectLevelLow());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.realtime.protection.configuration.utils.enums;
|
||||
|
||||
import com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleObject;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class RuleEnumTest {
|
||||
StaticRuleObject staticRuleObject;
|
||||
|
||||
public RuleEnumTest() {
|
||||
staticRuleObject = new StaticRuleObject();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRuleEnum() {
|
||||
assertDoesNotThrow(() -> {
|
||||
this.staticRuleObject.setStaticRuleDip("255.255.255.255");
|
||||
assertTrue(RuleEnum.checkValidate(staticRuleObject));
|
||||
this.staticRuleObject.setStaticRuleMsip("255.255.255.255");
|
||||
assertFalse(RuleEnum.checkValidate(staticRuleObject));
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user