Bump version-tracker from 3.1.0 to 3.1.1 (#425)
* Bump version-tracker from 3.1.0 to 3.1.1 Bumps version-tracker from 3.1.0 to 3.1.1. --- updated-dependencies: - dependency-name: net.kemitix.tiles:version-tracker dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Fixes for spotbugs Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Paul Campbell <pcampbell@kemitix.net>
This commit is contained in:
parent
c2e3234dd4
commit
b0663c2164
14 changed files with 118 additions and 60 deletions
|
@ -22,7 +22,7 @@
|
||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
<tiles-maven-plugin.version>2.23</tiles-maven-plugin.version>
|
<tiles-maven-plugin.version>2.23</tiles-maven-plugin.version>
|
||||||
<kemitix-maven-tiles.version>3.1.0</kemitix-maven-tiles.version>
|
<kemitix-maven-tiles.version>3.1.1</kemitix-maven-tiles.version>
|
||||||
|
|
||||||
<checkstyle.version>8.44</checkstyle.version>
|
<checkstyle.version>8.44</checkstyle.version>
|
||||||
<sevntu.version>1.40.0</sevntu.version>
|
<sevntu.version>1.40.0</sevntu.version>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.kemitix.checkstyle.ruleset.builder;
|
package net.kemitix.checkstyle.ruleset.builder;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import net.kemitix.files.FileReaderWriter;
|
import net.kemitix.files.FileReaderWriter;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@ -16,10 +15,19 @@ import java.util.stream.Collectors;
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net).
|
* @author Paul Campbell (pcampbell@kemitix.net).
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class BuilderConfiguration {
|
public class BuilderConfiguration {
|
||||||
|
|
||||||
private final SourcesProperties sourcesProperties;
|
private final transient SourcesProperties sourcesProperties =
|
||||||
|
new SourcesProperties();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of the class.
|
||||||
|
*
|
||||||
|
* @param sourcesProperties the source properties
|
||||||
|
*/
|
||||||
|
public BuilderConfiguration(final SourcesProperties sourcesProperties) {
|
||||||
|
this.sourcesProperties.setSources(sourcesProperties.getSources());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Map of rules for each RuleSource.
|
* A Map of rules for each RuleSource.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package net.kemitix.checkstyle.ruleset.builder;
|
package net.kemitix.checkstyle.ruleset.builder;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -14,11 +14,24 @@ import java.util.Objects;
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net).
|
* @author Paul Campbell (pcampbell@kemitix.net).
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class DefaultRuleClassLocator implements RuleClassLocator {
|
public class DefaultRuleClassLocator implements RuleClassLocator {
|
||||||
|
|
||||||
private final Map<RuleSource, List<String>> checkClasses;
|
private final transient Map<RuleSource, List<String>> checkClasses;
|
||||||
private final SourcesProperties sourcesProperties;
|
private final transient SourcesProperties sourcesProperties = new SourcesProperties();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of the class.
|
||||||
|
*
|
||||||
|
* @param checkClasses The list of check classes grouped by their source
|
||||||
|
* @param sourcesProperties the source properties
|
||||||
|
*/
|
||||||
|
public DefaultRuleClassLocator(
|
||||||
|
final Map<RuleSource, List<String>> checkClasses,
|
||||||
|
final SourcesProperties sourcesProperties
|
||||||
|
) {
|
||||||
|
this.checkClasses = new HashMap<>(checkClasses);
|
||||||
|
this.sourcesProperties.setSources(sourcesProperties.getSources());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String apply(final Rule rule) {
|
public final String apply(final Rule rule) {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.speedment.common.mapstream.MapStream;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
@ -18,8 +17,8 @@ import java.util.stream.Collectors;
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net)
|
* @author Paul Campbell (pcampbell@kemitix.net)
|
||||||
*/
|
*/
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@SuppressWarnings("methodcount")
|
||||||
public class Rule {
|
public final class Rule {
|
||||||
|
|
||||||
private static final Locale LOCALE = Locale.ENGLISH;
|
private static final Locale LOCALE = Locale.ENGLISH;
|
||||||
|
|
||||||
|
@ -31,11 +30,12 @@ public class Rule {
|
||||||
* Configuration properties.
|
* Configuration properties.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("PMD.UseConcurrentHashMap")
|
@SuppressWarnings("PMD.UseConcurrentHashMap")
|
||||||
private final Map<String, String> properties = new HashMap<>();
|
private Map<String, String> properties = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the rule's Check class.
|
* The name of the rule's Check class.
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,11 +46,13 @@ public class Rule {
|
||||||
/**
|
/**
|
||||||
* The first level the rule is enabled on.
|
* The first level the rule is enabled on.
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
private RuleLevel level;
|
private RuleLevel level;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the rule is enabled.
|
* Whether the rule is enabled.
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,18 +63,29 @@ public class Rule {
|
||||||
/**
|
/**
|
||||||
* URI for full official documentation.
|
* URI for full official documentation.
|
||||||
*/
|
*/
|
||||||
private URI uri;
|
@Getter
|
||||||
|
private String uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to indicate rules that can not be suppressed (via {@code @SuppressWarnings}.
|
* Flag to indicate rules that can not be suppressed (via {@code @SuppressWarnings}.
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
private boolean insuppressible;
|
private boolean insuppressible;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reason a rule has been disabled.
|
* The reason a rule has been disabled.
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
private String reason;
|
private String reason;
|
||||||
|
|
||||||
|
public void setProperties(final Map<String, String> properties) {
|
||||||
|
this.properties = new HashMap<>(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getProperties() {
|
||||||
|
return new HashMap<>(properties);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two Rules lexicographically for sorting by rule name, ignoring case.
|
* Compare two Rules lexicographically for sorting by rule name, ignoring case.
|
||||||
*
|
*
|
||||||
|
@ -83,9 +96,9 @@ public class Rule {
|
||||||
* the right string; and a value greater than 0 if the left string is lexicographically greater than the right
|
* the right string; and a value greater than 0 if the left string is lexicographically greater than the right
|
||||||
* string.
|
* string.
|
||||||
*/
|
*/
|
||||||
protected static int sortByName(final Rule left, final Rule right) {
|
public static int sortByName(final Rule left, final Rule right) {
|
||||||
return left.getName().toLowerCase(LOCALE)
|
return left.name.toLowerCase(LOCALE)
|
||||||
.compareTo(right.getName().toLowerCase(LOCALE));
|
.compareTo(right.name.toLowerCase(LOCALE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +109,7 @@ public class Rule {
|
||||||
* @return a Predicate to check a Rule
|
* @return a Predicate to check a Rule
|
||||||
*/
|
*/
|
||||||
static Predicate<Rule> hasParent(final RuleParent ruleParent) {
|
static Predicate<Rule> hasParent(final RuleParent ruleParent) {
|
||||||
return rule -> ruleParent == rule.getParent();
|
return rule -> ruleParent == rule.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,7 +120,7 @@ public class Rule {
|
||||||
* @return a Predicate to check a Rule
|
* @return a Predicate to check a Rule
|
||||||
*/
|
*/
|
||||||
static Predicate<Rule> isIncludedInLevel(final RuleLevel ruleLevel) {
|
static Predicate<Rule> isIncludedInLevel(final RuleLevel ruleLevel) {
|
||||||
return rule -> ruleLevel.compareTo(rule.getLevel()) >= 0;
|
return rule -> ruleLevel.compareTo(rule.level) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String formatProperties(final Map<String, String> properties) {
|
private static String formatProperties(final Map<String, String> properties) {
|
||||||
|
|
|
@ -1,20 +1,36 @@
|
||||||
package net.kemitix.checkstyle.ruleset.builder;
|
package net.kemitix.checkstyle.ruleset.builder;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class RuleLoader {
|
public class RuleLoader {
|
||||||
|
|
||||||
private static final String NEWLINE = "\n";
|
private static final String NEWLINE = "\n";
|
||||||
|
|
||||||
private final RulesProperties rulesProperties;
|
private final transient RulesProperties rulesProperties;
|
||||||
private final RuleReadmeLoader ruleReadmeLoader;
|
private final transient RuleReadmeLoader ruleReadmeLoader;
|
||||||
private final SourcesProperties sourcesProperties;
|
private final transient SourcesProperties sourcesProperties =
|
||||||
|
new SourcesProperties();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of the class.
|
||||||
|
*
|
||||||
|
* @param rulesProperties the rules priorities
|
||||||
|
* @param ruleReadmeLoader the README loader
|
||||||
|
* @param sourcesProperties the source priorities
|
||||||
|
*/
|
||||||
|
public RuleLoader(
|
||||||
|
final RulesProperties rulesProperties,
|
||||||
|
final RuleReadmeLoader ruleReadmeLoader,
|
||||||
|
final SourcesProperties sourcesProperties
|
||||||
|
) {
|
||||||
|
this.rulesProperties = rulesProperties;
|
||||||
|
this.ruleReadmeLoader = ruleReadmeLoader;
|
||||||
|
this.sourcesProperties.setSources(sourcesProperties.getSources());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads from the source, where the source is enabled, all rules that are
|
* Loads from the source, where the source is enabled, all rules that are
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package net.kemitix.checkstyle.ruleset.builder;
|
package net.kemitix.checkstyle.ruleset.builder;
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@ -14,13 +12,20 @@ import java.util.Optional;
|
||||||
*
|
*
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net)
|
* @author Paul Campbell (pcampbell@kemitix.net)
|
||||||
*/
|
*/
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConfigurationProperties("")
|
@ConfigurationProperties("")
|
||||||
class SourcesProperties {
|
class SourcesProperties {
|
||||||
|
|
||||||
private List<RuleSource> sources = new ArrayList<>();
|
private final List<RuleSource> sources = new ArrayList<>();
|
||||||
|
|
||||||
|
public void setSources(final List<RuleSource> sources) {
|
||||||
|
this.sources.clear();
|
||||||
|
this.sources.addAll(sources);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RuleSource> getSources() {
|
||||||
|
return new ArrayList<>(sources);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for a RuleSource by name.
|
* Search for a RuleSource by name.
|
||||||
|
|
|
@ -165,8 +165,7 @@ public class CheckstyleWriterTest {
|
||||||
public void writeRuleWithProperties() throws Exception {
|
public void writeRuleWithProperties() throws Exception {
|
||||||
//given
|
//given
|
||||||
val rule = enabledRule(RuleLevel.LAYOUT, RuleParent.TREEWALKER);
|
val rule = enabledRule(RuleLevel.LAYOUT, RuleParent.TREEWALKER);
|
||||||
rule.getProperties()
|
rule.setProperties(Map.of("key", "value"));
|
||||||
.put("key", "value");
|
|
||||||
rulesProperties.getRules()
|
rulesProperties.getRules()
|
||||||
.add(rule);
|
.add(rule);
|
||||||
//when
|
//when
|
||||||
|
|
|
@ -19,21 +19,9 @@ public class DefaultRuleClassLocatorTest {
|
||||||
|
|
||||||
private SourcesProperties sourceProperties = new SourcesProperties();
|
private SourcesProperties sourceProperties = new SourcesProperties();
|
||||||
|
|
||||||
private final DefaultRuleClassLocator subject =
|
|
||||||
new DefaultRuleClassLocator(
|
|
||||||
checkClasses,
|
|
||||||
sourceProperties);
|
|
||||||
|
|
||||||
private final RuleSource checkstyleRuleSource = RuleSourceMother.checkstyle.get();
|
private final RuleSource checkstyleRuleSource = RuleSourceMother.checkstyle.get();
|
||||||
private final RuleSource sevntuRuleSource = RuleSourceMother.sevntu.get();
|
private final RuleSource sevntuRuleSource = RuleSourceMother.sevntu.get();
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
public void setUp() {
|
|
||||||
sourceProperties.setSources(Arrays.asList(
|
|
||||||
checkstyleRuleSource, sevntuRuleSource
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void canLookupRuleWithClassNameEndingInCheck() {
|
public void canLookupRuleWithClassNameEndingInCheck() {
|
||||||
//given
|
//given
|
||||||
|
@ -43,7 +31,14 @@ public class DefaultRuleClassLocatorTest {
|
||||||
final List<String> sevntuClasses = Collections.emptyList();
|
final List<String> sevntuClasses = Collections.emptyList();
|
||||||
checkClasses.put(checkstyleRuleSource, checkstyleClasses);
|
checkClasses.put(checkstyleRuleSource, checkstyleClasses);
|
||||||
checkClasses.put(sevntuRuleSource, sevntuClasses);
|
checkClasses.put(sevntuRuleSource, sevntuClasses);
|
||||||
|
sourceProperties.setSources(Arrays.asList(
|
||||||
|
checkstyleRuleSource, sevntuRuleSource
|
||||||
|
));
|
||||||
final Rule rule = createCheckstyleRule(rulename);
|
final Rule rule = createCheckstyleRule(rulename);
|
||||||
|
DefaultRuleClassLocator subject =
|
||||||
|
new DefaultRuleClassLocator(
|
||||||
|
checkClasses,
|
||||||
|
sourceProperties);
|
||||||
//when
|
//when
|
||||||
final String result = subject.apply(rule);
|
final String result = subject.apply(rule);
|
||||||
//then
|
//then
|
||||||
|
@ -59,7 +54,14 @@ public class DefaultRuleClassLocatorTest {
|
||||||
final List<String> sevntuClasses = Collections.emptyList();
|
final List<String> sevntuClasses = Collections.emptyList();
|
||||||
checkClasses.put(checkstyleRuleSource, checkstyleClasses);
|
checkClasses.put(checkstyleRuleSource, checkstyleClasses);
|
||||||
checkClasses.put(sevntuRuleSource, sevntuClasses);
|
checkClasses.put(sevntuRuleSource, sevntuClasses);
|
||||||
|
sourceProperties.setSources(Arrays.asList(
|
||||||
|
checkstyleRuleSource, sevntuRuleSource
|
||||||
|
));
|
||||||
final Rule rule = createCheckstyleRule(rulename);
|
final Rule rule = createCheckstyleRule(rulename);
|
||||||
|
DefaultRuleClassLocator subject =
|
||||||
|
new DefaultRuleClassLocator(
|
||||||
|
checkClasses,
|
||||||
|
sourceProperties);
|
||||||
//when
|
//when
|
||||||
final String result = subject.apply(rule);
|
final String result = subject.apply(rule);
|
||||||
//then
|
//then
|
||||||
|
@ -76,6 +78,10 @@ public class DefaultRuleClassLocatorTest {
|
||||||
checkClasses.put(checkstyleRuleSource, checkstyleClasses);
|
checkClasses.put(checkstyleRuleSource, checkstyleClasses);
|
||||||
checkClasses.put(sevntuRuleSource, sevntuClasses);
|
checkClasses.put(sevntuRuleSource, sevntuClasses);
|
||||||
final Rule rule = createCheckstyleRule(rulename);
|
final Rule rule = createCheckstyleRule(rulename);
|
||||||
|
DefaultRuleClassLocator subject =
|
||||||
|
new DefaultRuleClassLocator(
|
||||||
|
checkClasses,
|
||||||
|
sourceProperties);
|
||||||
//then
|
//then
|
||||||
assertThatThrownBy(() -> subject.apply(rule))
|
assertThatThrownBy(() -> subject.apply(rule))
|
||||||
.isInstanceOf(CheckstyleClassNotFoundException.class)
|
.isInstanceOf(CheckstyleClassNotFoundException.class)
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class DefaultRuleReadmeLoaderTest
|
||||||
loader = new DefaultRuleReadmeLoader(templateProperties);
|
loader = new DefaultRuleReadmeLoader(templateProperties);
|
||||||
rule = new Rule();
|
rule = new Rule();
|
||||||
rule.setName("name");
|
rule.setName("name");
|
||||||
rule.setUri(URI.create("uri"));
|
rule.setUri("uri");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -48,12 +48,6 @@ public class RuleLoaderTest {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
MockitoAnnotations.openMocks(this).close();
|
MockitoAnnotations.openMocks(this).close();
|
||||||
|
|
||||||
ruleLoader =
|
|
||||||
new RuleLoader(
|
|
||||||
ruleProperties,
|
|
||||||
ruleReadmeLoader,
|
|
||||||
sourcesProperties);
|
|
||||||
|
|
||||||
enabledRule.setEnabled(true);
|
enabledRule.setEnabled(true);
|
||||||
enabledRule.setName(enabledRuleName);
|
enabledRule.setName(enabledRuleName);
|
||||||
|
|
||||||
|
@ -76,12 +70,18 @@ public class RuleLoaderTest {
|
||||||
false,
|
false,
|
||||||
disabledRuleSourcePackage);
|
disabledRuleSourcePackage);
|
||||||
ruleSources.add(disabledRuleSource);
|
ruleSources.add(disabledRuleSource);
|
||||||
|
sourcesProperties.setSources(ruleSources);
|
||||||
rules.add(disabledRule);
|
rules.add(disabledRule);
|
||||||
disabledRuleLines.add(disabledRuleLineOne);
|
disabledRuleLines.add(disabledRuleLineOne);
|
||||||
disabledRuleLines.add(disabledRuleLineTwo);
|
disabledRuleLines.add(disabledRuleLineTwo);
|
||||||
given(ruleReadmeLoader.load(disabledRule))
|
given(ruleReadmeLoader.load(disabledRule))
|
||||||
.willReturn(disabledRuleLines.stream());
|
.willReturn(disabledRuleLines.stream());
|
||||||
}
|
|
||||||
|
ruleLoader =
|
||||||
|
new RuleLoader(
|
||||||
|
ruleProperties,
|
||||||
|
ruleReadmeLoader,
|
||||||
|
sourcesProperties); }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void enabledForEnabledSource() {
|
public void enabledForEnabledSource() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.assertj.core.api.SoftAssertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link Rule}.
|
* Tests for {@link Rule}.
|
||||||
|
@ -31,7 +31,7 @@ public class RuleTest {
|
||||||
val level = RuleLevel.LAYOUT;
|
val level = RuleLevel.LAYOUT;
|
||||||
val enabled = true;
|
val enabled = true;
|
||||||
val insuppressible = true;
|
val insuppressible = true;
|
||||||
val uri = URI.create("rule://name.md");
|
val uri = "rule://name.md";
|
||||||
val reason = "reason";
|
val reason = "reason";
|
||||||
val key = "key";
|
val key = "key";
|
||||||
val value = "value";
|
val value = "value";
|
||||||
|
@ -44,16 +44,12 @@ public class RuleTest {
|
||||||
rule.setInsuppressible(insuppressible);
|
rule.setInsuppressible(insuppressible);
|
||||||
rule.setUri(uri);
|
rule.setUri(uri);
|
||||||
rule.setReason(reason);
|
rule.setReason(reason);
|
||||||
rule.getProperties()
|
rule.setProperties(Map.of(key, value));
|
||||||
.put(key, value);
|
|
||||||
//then
|
//then
|
||||||
SoftAssertions.assertSoftly(softly -> {
|
SoftAssertions.assertSoftly(softly -> {
|
||||||
softly.assertThat(rule.getName())
|
softly.assertThat(rule.getName())
|
||||||
.as("set/getName()")
|
.as("set/getName()")
|
||||||
.isEqualTo(name);
|
.isEqualTo(name);
|
||||||
softly.assertThat(rule.getParent())
|
|
||||||
.as("set/getParent()")
|
|
||||||
.isEqualTo(parent);
|
|
||||||
softly.assertThat(rule.getLevel())
|
softly.assertThat(rule.getLevel())
|
||||||
.as("set/getLevel()")
|
.as("set/getLevel()")
|
||||||
.isEqualTo(level);
|
.isEqualTo(level);
|
||||||
|
|
|
@ -3,6 +3,8 @@ package net.kemitix.checkstyle.ruleset.builder;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
public class SourcesPropertiesTest {
|
public class SourcesPropertiesTest {
|
||||||
|
@ -24,7 +26,7 @@ public class SourcesPropertiesTest {
|
||||||
final RuleSource source =
|
final RuleSource source =
|
||||||
RuleSourceMother.create("name", true, "package");
|
RuleSourceMother.create("name", true, "package");
|
||||||
//when
|
//when
|
||||||
sourcesProperties.getSources().add(source);
|
sourcesProperties.setSources(Collections.singletonList(source));
|
||||||
//then
|
//then
|
||||||
assertThat(sourcesProperties.getSources()).containsExactly(source);
|
assertThat(sourcesProperties.getSources()).containsExactly(source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<tiles-maven-plugin.version>2.23</tiles-maven-plugin.version>
|
<tiles-maven-plugin.version>2.23</tiles-maven-plugin.version>
|
||||||
<kemitix-tiles.version>3.1.0</kemitix-tiles.version>
|
<kemitix-tiles.version>3.1.1</kemitix-tiles.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<tiles-maven-plugin.version>2.23</tiles-maven-plugin.version>
|
<tiles-maven-plugin.version>2.23</tiles-maven-plugin.version>
|
||||||
<kemitix-maven-tiles.version>3.1.0</kemitix-maven-tiles.version>
|
<kemitix-maven-tiles.version>3.1.1</kemitix-maven-tiles.version>
|
||||||
|
|
||||||
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
|
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
|
||||||
<checkstyle.version>8.44</checkstyle.version>
|
<checkstyle.version>8.44</checkstyle.version>
|
||||||
|
|
Loading…
Reference in a new issue