Skip to content

Commit 6bec55f

Browse files
committed
chore(qulice): resolved all Qulice warnings
1 parent 626d405 commit 6bec55f

File tree

7 files changed

+50
-38
lines changed

7 files changed

+50
-38
lines changed

src/main/java/ru/ewc/checklogic/ServerInstance.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ public boolean isAvailable(final String command, final String field) {
130130
}
131131

132132
public void update(final List<String> values) {
133-
final InMemoryLocator request = InMemoryLocator.empty(requestLocatorName());
133+
final InMemoryLocator request = InMemoryLocator.empty(this.requestLocatorName());
134134
values.forEach(
135135
value -> {
136136
final String[] split = value.split(":");
137137
request.setFragmentValue(split[0].trim(), split[1].trim());
138138
});
139-
this.state.locators().put(this.server.requestLocatorName(), request);
139+
this.state.locators().put(this.requestLocatorName(), request);
140140
this.context = new ComputationContext(this.state, this.getAllTables());
141141
}
142142

src/main/java/ru/ewc/checklogic/server/AllEndpoints.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public final class AllEndpoints implements Endpoints {
4646
*/
4747
private final WebPages pages;
4848

49-
public AllEndpoints(final ServerInstance context, ServerConfiguration configuration) {
49+
public AllEndpoints(final ServerInstance context, final ServerConfiguration config) {
5050
this.context = context;
51-
this.pages = WebPages.create(new ResourceTemplateRender(), context.getRoot(), configuration);
51+
this.pages = new WebPages(new ResourceTemplateRender(), context.getRoot(), config);
5252
}
5353

5454
@Override

src/main/java/ru/ewc/checklogic/server/WebPages.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,21 @@ public final class WebPages {
5454
*/
5555
private final String root;
5656

57+
/**
58+
* Server configuration that holds the request locator name.
59+
*/
5760
private final ServerConfiguration config;
5861

59-
private WebPages(final TemplateRender processors, final String root, ServerConfiguration config) {
62+
public WebPages(
63+
final TemplateRender processors,
64+
final String root,
65+
final ServerConfiguration config
66+
) {
6067
this.processors = processors;
6168
this.root = root;
6269
this.config = config;
6370
}
6471

65-
public static WebPages create(final TemplateRender processors, final String root, ServerConfiguration configuration) {
66-
return new WebPages(processors, root, configuration);
67-
}
68-
6972
public static WebPages testable() {
7073
return new WebPages(new MockTemplateRender(), "root folder", new ServerConfiguration());
7174
}

src/main/java/ru/ewc/checklogic/testing/CheckFailure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* MIT License
33
*
4-
* Copyright (c) 2024 Eugene Terekhov
4+
* Copyright (c) 2024 Decision-Driven Development
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal

src/main/java/ru/ewc/checklogic/testing/CheckFile.java

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,37 @@
3333
import ru.ewc.decisions.commands.Assignment;
3434
import ru.ewc.decisions.conditions.Condition;
3535

36-
public class CheckFile {
37-
private final List<RuleFragments> rules;
36+
/**
37+
* I am a single file containing one or more tests. I am responsible for performing all the tests
38+
* and logging the results.
39+
*
40+
* @since 0.4.1
41+
*/
42+
public final class CheckFile {
43+
/**
44+
* The collection of single tests inside the file.
45+
*/
46+
private final List<RuleFragments> tests;
3847

39-
public CheckFile(List<RuleFragments> rules) {
40-
this.rules = rules;
48+
public CheckFile(final List<RuleFragments> tests) {
49+
this.tests = tests;
4150
}
4251

43-
public List<TestResult> performChecks(ComputationContext context, String locator) {
44-
return this.rules.stream()
52+
public List<TestResult> performChecks(final ComputationContext context, final String locator) {
53+
return this.tests.stream()
4554
.map(rule -> CheckFile.performAndLog(context, rule, locator))
4655
.toList();
4756
}
4857

49-
private static TestResult performAndLog(final ComputationContext ctx, final RuleFragments rule, String locator) {
58+
private static TestResult performAndLog(
59+
final ComputationContext ctx,
60+
final RuleFragments rule,
61+
final String locator
62+
) {
5063
logCheckpoint(ctx, "%s - started".formatted(rule.header()));
5164
final OutputTracker<String> tracker = ctx.startTracking();
52-
List<CheckFailure> failures = new ArrayList<>(1);
53-
for (RuleFragment fragment : rule.getFragments()) {
65+
final List<CheckFailure> failures = new ArrayList<>(1);
66+
for (final RuleFragment fragment : rule.getFragments()) {
5467
if (fragment.nonEmptyOfType("CND")) {
5568
final Condition check = Condition.from(fragment);
5669
if (!check.evaluate(ctx)) {
@@ -69,7 +82,11 @@ private static TestResult performAndLog(final ComputationContext ctx, final Rule
6982
);
7083
}
7184

72-
private static void perform(RuleFragment fragment, ComputationContext ctx, String locator) {
85+
private static void perform(
86+
final RuleFragment fragment,
87+
final ComputationContext ctx,
88+
final String locator
89+
) {
7390
switch (fragment.type()) {
7491
case "ASG" -> new Assignment(fragment.left(), fragment.right()).performIn(ctx);
7592
case "OUT" -> {
@@ -79,7 +96,6 @@ private static void perform(RuleFragment fragment, ComputationContext ctx, Strin
7996
}
8097
}
8198
default -> {
82-
// do nothing, because we don't know what to do with such a fragment type
8399
}
84100
}
85101
}

src/main/java/ru/ewc/checklogic/testing/CheckSuite.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* MIT License
33
*
4-
* Copyright (c) 2024 Eugene Terekhov
4+
* Copyright (c) 2024 Decision-Driven Development
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -30,10 +30,10 @@
3030
import ru.ewc.decisions.input.ContentsReader;
3131

3232
/**
33-
* I represent a collection of test-cases to performChecks. My main responsibility is to run all the tests
34-
* and collect the results.
33+
* I represent a collection of test-cases to performChecks. My main responsibility is to run all
34+
* the tests and collect the results.
3535
*
36-
* @since 0.8.0
36+
* @since 0.4.1
3737
*/
3838
@SuppressWarnings("PMD.ProhibitPublicStaticMethods")
3939
public final class CheckSuite {
@@ -49,7 +49,8 @@ private CheckSuite(final Collection<CheckFile> tests) {
4949
public static CheckSuite using(final ContentsReader reader) {
5050
return new CheckSuite(reader.readAll().stream()
5151
.map(sl -> new CheckFile(sl.specifiedRulesFragments()))
52-
.toList());
52+
.toList()
53+
);
5354
}
5455

5556
public List<TestResult> perform(final ComputationContext context, final String locator) {

src/main/java/ru/ewc/checklogic/testing/CheckResult.java renamed to src/main/java/ru/ewc/checklogic/testing/package-info.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,8 @@
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
* SOFTWARE.
2323
*/
24-
package ru.ewc.checklogic.testing;
25-
26-
import ru.ewc.decisions.api.RuleFragments;
27-
28-
public class CheckResult {
29-
private final RuleFragments rule;
30-
31-
public CheckResult(RuleFragments rule) {
32-
this.rule = rule;
33-
}
3424

35-
36-
}
25+
/**
26+
* Package for all the testing-related classes.
27+
*/
28+
package ru.ewc.checklogic.testing;

0 commit comments

Comments
 (0)