Skip to content

Commit 547f897

Browse files
authored
Merge pull request #655 from AustinShalit/pmd-test
PMD for tests
2 parents 4eefca3 + 06d9c57 commit 547f897

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+100
-71
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ install:
3030
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && ./gradlew :ui:jfxNative --stacktrace || ./gradlew --stacktrace '
3131

3232
script:
33-
- ./gradlew checkstyleMain checkstyleTest pmdMain jacocoTestReport jacocoRootReport test --stacktrace -Pheadless=true -PlogTests
33+
- ./gradlew checkstyleMain checkstyleTest pmdMain pmdTest jacocoTestReport jacocoRootReport test --stacktrace -Pheadless=true -PlogTests
3434

3535
after_success:
3636
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then codecov ; fi

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build_script:
66

77
# to run your custom scripts instead of automatic tests
88
test_script:
9-
- gradlew.bat checkstyleMain checkstyleTest pmdMain jacocoTestReport jacocoRootReport test --stacktrace -Pheadless=true -PlogTests
9+
- gradlew.bat checkstyleMain checkstyleTest pmdMain pmdTest jacocoTestReport jacocoRootReport test --stacktrace -Pheadless=true -PlogTests
1010

1111
platform:
1212
- x64

core/src/test/java/edu/wpi/grip/core/AddOperation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
public class AddOperation implements Operation {
2323
public static final OperationDescription DESCRIPTION = OperationDescription
2424
.builder().name("OpenCV Add").summary("Compute the per-pixel sum of two images.").build();
25-
private SocketHint<Mat> aHint = SocketHints.Inputs.createMatSocketHint("a", false);
26-
private SocketHint<Mat> bHint = SocketHints.Inputs.createMatSocketHint("b", false);
27-
private SocketHint<Mat> sumHint = SocketHints.Inputs.createMatSocketHint("sum", true);
25+
private final SocketHint<Mat> aHint = SocketHints.Inputs.createMatSocketHint("a", false);
26+
private final SocketHint<Mat> bHint = SocketHints.Inputs.createMatSocketHint("b", false);
27+
private final SocketHint<Mat> sumHint = SocketHints.Inputs.createMatSocketHint("sum", true);
2828

2929
private InputSocket<Mat> a;
3030
private InputSocket<Mat> b;

core/src/test/java/edu/wpi/grip/core/AdditionOperation.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ public class AdditionOperation implements Operation {
1515
.name("Add")
1616
.summary("Compute the sum of two doubles")
1717
.build();
18-
private SocketHint<Number> aHint = SocketHints.createNumberSocketHint("a", 0.0);
19-
private SocketHint<Number> bHint = SocketHints.createNumberSocketHint("b", 0.0);
20-
private SocketHint<Number> cHint = SocketHints.Outputs.createNumberSocketHint("c", 0.0);
18+
private final SocketHint<Number> aHint = SocketHints.createNumberSocketHint("a", 0.0);
19+
private final SocketHint<Number> bHint = SocketHints.createNumberSocketHint("b", 0.0);
20+
private final SocketHint<Number> cHint = SocketHints.Outputs.createNumberSocketHint("c", 0.0);
2121

22-
private InputSocket<Number> a;
23-
private InputSocket<Number> b;
24-
private OutputSocket<Number> c;
22+
private final InputSocket<Number> a;
23+
private final InputSocket<Number> b;
24+
private final OutputSocket<Number> c;
2525

2626
public AdditionOperation(InputSocket.Factory isf, OutputSocket.Factory osf) {
2727
a = isf.create(aHint);

core/src/test/java/edu/wpi/grip/core/ConnectionTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ public class ConnectionTest {
1919
private static final Number testValue = Double.valueOf(12345.6789);
2020

2121
private EventBus eventBus;
22-
private SocketHint<Number> fooHint;
23-
private SocketHint<Number> barHint;
2422

2523
private OutputSocket<Number> foo;
2624
private InputSocket<Number> bar;
@@ -29,8 +27,8 @@ public class ConnectionTest {
2927
public void setUp() {
3028
eventBus = new EventBus();
3129

32-
fooHint = SocketHints.createNumberSocketHint("foo", 0.0);
33-
barHint = SocketHints.createNumberSocketHint("bar", 0.0);
30+
SocketHint<Number> fooHint = SocketHints.createNumberSocketHint("foo", 0.0);
31+
SocketHint<Number> barHint = SocketHints.createNumberSocketHint("bar", 0.0);
3432

3533
InputSocket.Factory isf = new MockInputSocketFactory(eventBus);
3634
OutputSocket.Factory osf = new MockOutputSocketFactory(eventBus);

core/src/test/java/edu/wpi/grip/core/CoreSanityTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import java.util.Arrays;
1616

17+
@SuppressWarnings("PMD.TestClassWithoutTestCases")
1718
public class CoreSanityTest extends AbstractPackageSanityTests {
1819

1920
public CoreSanityTest() {

core/src/test/java/edu/wpi/grip/core/ManualPipelineRunner.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public PipelineRunner startAsync() {
2121
return this;
2222
}
2323

24+
@SuppressWarnings("PMD.UselessOverridingMethod")
2425
public void runPipeline() {
2526
super.runPipeline();
2627
}

core/src/test/java/edu/wpi/grip/core/MockOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ public List<OutputSocket> getOutputSockets() {
2727

2828
@Override
2929
public void perform() {
30-
30+
// This operation does nothing because it is a mock.
3131
}
3232
}

core/src/test/java/edu/wpi/grip/core/MockSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ public Properties getProperties() {
3737

3838
@Override
3939
public void initialize() throws IOException {
40-
40+
// This source has no init because it is just a mock.
4141
}
4242
}

core/src/test/java/edu/wpi/grip/core/StepTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
public class StepTest {
2020
private EventBus eventBus;
2121
private OperationMetaData additionMeta;
22-
private GripCoreTestModule testModule = new GripCoreTestModule();
22+
private final GripCoreTestModule testModule = new GripCoreTestModule();
2323

2424
@Before
2525
public void setUp() {

0 commit comments

Comments
 (0)