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

Commit

Permalink
Solve some SonarQube issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Feb 23, 2017
1 parent 62ccab4 commit 358e79b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected void addNewVariables(Collection<FlowVariable> newVariables) {
// Old variable has the same value
push = false;
} else if (variable.getType().equals(Type.DOUBLE)
&& new Double(oldVariable.getDoubleValue()).equals(new Double(variable.getDoubleValue()))) {
&& Double.valueOf(oldVariable.getDoubleValue()).equals(Double.valueOf(variable.getDoubleValue()))) {
// Old variable has the same value
push = false;
} else if (variable.getType().equals(Type.STRING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.knime.core.node.workflow.FlowVariable;

public class ConcreteNodeModel extends PythonWrapperNodeModel<ConcreteNodeConfig> {
public Collection<FlowVariable> variables;
private Collection<FlowVariable> variables;

public ConcreteNodeModel(PortType[] inPortTypes, PortType[] outPortTypes) {
super(inPortTypes, outPortTypes);
Expand All @@ -17,7 +17,7 @@ public ConcreteNodeModel(PortType[] inPortTypes, PortType[] outPortTypes) {

public ConcreteNodeModel() {
this(new PortType[] { BufferedDataTable.TYPE }, new PortType[] { BufferedDataTable.TYPE });
};
}

@Override
protected void addNewVariables(Collection<FlowVariable> newVariables) {
Expand All @@ -27,6 +27,10 @@ protected void addNewVariables(Collection<FlowVariable> newVariables) {
this.variables = newVariables;
}

public Collection<FlowVariable> getVariables() {
return variables;
}

@Override
protected ConcreteNodeConfig createConfig() {
return new ConcreteNodeConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void testValidPython_NoPackageequired() throws InvalidSettingsException {
}

@Test
public void getPythonCode() throws IOException, Exception {
public void getPythonCode() throws IOException {
ConcreteNodeModel model = new ConcreteNodeModel();

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

@Test
public void getPythonCode_missingpyfile() throws IOException, Exception {
public void getPythonCode_missingpyfile() throws IOException {
FoobarNodeModel model = new FoobarNodeModel();
thrown.expect(FileNotFoundException.class);
thrown.expectMessage("foobar_test.py");
Expand All @@ -124,7 +124,7 @@ public void getPythonCode_missingpyfile() throws IOException, Exception {
}

@Test
public void testExecuteKernel() throws IOException, Exception {
public void testExecuteKernel() throws Exception {
ConcreteNodeModel model = new ConcreteNodeModel();
BufferedDataTable[] inData = { mock(BufferedDataTable.class) };
ExecutionContext exec = mock(ExecutionContext.class);
Expand All @@ -146,7 +146,7 @@ public void testExecuteKernel() throws IOException, Exception {
}

@Test
public void testExecuteKernel__warningMessageSet() throws IOException, Exception {
public void testExecuteKernel__warningMessageSet() throws Exception {
ConcreteNodeModel model = new ConcreteNodeModel();
BufferedDataTable[] inData = { mock(BufferedDataTable.class) };
ExecutionContext exec = mock(ExecutionContext.class);
Expand All @@ -164,6 +164,6 @@ public void testExecuteKernel__warningMessageSet() throws IOException, Exception
model.executeKernel(inData, exec, kernel);

verify(listener, times(1)).warningChanged(eq("some warning"));
assertEquals(variables, model.variables);
assertEquals(variables, model.getVariables());
}
}

0 comments on commit 358e79b

Please sign in to comment.