Skip to content
This repository was archived by the owner on Nov 23, 2023. It is now read-only.

Commit 358e79b

Browse files
committed
Solve some SonarQube issues
1 parent 62ccab4 commit 358e79b

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

plugin/src/java/nl/esciencecenter/e3dchem/python/PythonWrapperNodeModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ protected void addNewVariables(Collection<FlowVariable> newVariables) {
119119
// Old variable has the same value
120120
push = false;
121121
} else if (variable.getType().equals(Type.DOUBLE)
122-
&& new Double(oldVariable.getDoubleValue()).equals(new Double(variable.getDoubleValue()))) {
122+
&& Double.valueOf(oldVariable.getDoubleValue()).equals(Double.valueOf(variable.getDoubleValue()))) {
123123
// Old variable has the same value
124124
push = false;
125125
} else if (variable.getType().equals(Type.STRING)

tests/src/java/nl/esciencecenter/e3dchem/python/ConcreteNodeModel.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import org.knime.core.node.workflow.FlowVariable;
88

99
public class ConcreteNodeModel extends PythonWrapperNodeModel<ConcreteNodeConfig> {
10-
public Collection<FlowVariable> variables;
10+
private Collection<FlowVariable> variables;
1111

1212
public ConcreteNodeModel(PortType[] inPortTypes, PortType[] outPortTypes) {
1313
super(inPortTypes, outPortTypes);
@@ -17,7 +17,7 @@ public ConcreteNodeModel(PortType[] inPortTypes, PortType[] outPortTypes) {
1717

1818
public ConcreteNodeModel() {
1919
this(new PortType[] { BufferedDataTable.TYPE }, new PortType[] { BufferedDataTable.TYPE });
20-
};
20+
}
2121

2222
@Override
2323
protected void addNewVariables(Collection<FlowVariable> newVariables) {
@@ -27,6 +27,10 @@ protected void addNewVariables(Collection<FlowVariable> newVariables) {
2727
this.variables = newVariables;
2828
}
2929

30+
public Collection<FlowVariable> getVariables() {
31+
return variables;
32+
}
33+
3034
@Override
3135
protected ConcreteNodeConfig createConfig() {
3236
return new ConcreteNodeConfig();

tests/src/java/nl/esciencecenter/e3dchem/python/PythonWrapperNodeModelTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void testValidPython_NoPackageequired() throws InvalidSettingsException {
105105
}
106106

107107
@Test
108-
public void getPythonCode() throws IOException, Exception {
108+
public void getPythonCode() throws IOException {
109109
ConcreteNodeModel model = new ConcreteNodeModel();
110110

111111
String code = model.getPythonCode();
@@ -115,7 +115,7 @@ public void getPythonCode() throws IOException, Exception {
115115
}
116116

117117
@Test
118-
public void getPythonCode_missingpyfile() throws IOException, Exception {
118+
public void getPythonCode_missingpyfile() throws IOException {
119119
FoobarNodeModel model = new FoobarNodeModel();
120120
thrown.expect(FileNotFoundException.class);
121121
thrown.expectMessage("foobar_test.py");
@@ -124,7 +124,7 @@ public void getPythonCode_missingpyfile() throws IOException, Exception {
124124
}
125125

126126
@Test
127-
public void testExecuteKernel() throws IOException, Exception {
127+
public void testExecuteKernel() throws Exception {
128128
ConcreteNodeModel model = new ConcreteNodeModel();
129129
BufferedDataTable[] inData = { mock(BufferedDataTable.class) };
130130
ExecutionContext exec = mock(ExecutionContext.class);
@@ -146,7 +146,7 @@ public void testExecuteKernel() throws IOException, Exception {
146146
}
147147

148148
@Test
149-
public void testExecuteKernel__warningMessageSet() throws IOException, Exception {
149+
public void testExecuteKernel__warningMessageSet() throws Exception {
150150
ConcreteNodeModel model = new ConcreteNodeModel();
151151
BufferedDataTable[] inData = { mock(BufferedDataTable.class) };
152152
ExecutionContext exec = mock(ExecutionContext.class);
@@ -164,6 +164,6 @@ public void testExecuteKernel__warningMessageSet() throws IOException, Exception
164164
model.executeKernel(inData, exec, kernel);
165165

166166
verify(listener, times(1)).warningChanged(eq("some warning"));
167-
assertEquals(variables, model.variables);
167+
assertEquals(variables, model.getVariables());
168168
}
169169
}

0 commit comments

Comments
 (0)