Skip to content

Commit

Permalink
Fix nullpointer exception when reporting with TakeAllSelector (#947)
Browse files Browse the repository at this point in the history
  • Loading branch information
lacinoire authored Jun 1, 2020
1 parent b256e9c commit aaec93a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package eu.stamp_project.dspot.common.report.output.selector.takeall.json;

/**
* Created by Carolin BRANDT
* [email protected]
* on 05/14/20
*/
public class TestClassJSON implements eu.stamp_project.dspot.common.report.output.selector.TestClassJSON {

public String toString(){
return "";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import eu.stamp_project.dspot.common.configuration.UserInput;
import eu.stamp_project.dspot.common.report.output.selector.TestSelectorElementReport;
import eu.stamp_project.dspot.common.report.output.selector.TestSelectorElementReportImpl;
import eu.stamp_project.dspot.common.report.output.selector.takeall.json.TestClassJSON;
import spoon.reflect.declaration.CtMethod;
import spoon.reflect.declaration.CtType;

Expand Down Expand Up @@ -51,7 +52,7 @@ public List<CtMethod<?>> selectToKeep(List<CtMethod<?>> amplifiedTestToBeKept) {
public TestSelectorElementReport report() {
final String report = "Amplification results with " + this.selectedAmplifiedTest.size() + " new tests.";
reset();
return new TestSelectorElementReportImpl(report, null, Collections.emptyList(), "");
return new TestSelectorElementReportImpl(report, new TestClassJSON(), Collections.emptyList(), "");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.util.Collections;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

/**
Expand Down Expand Up @@ -47,4 +48,9 @@ public void testSelector() throws Exception {
assertFalse(this.testSelectorUnderTest.getAmplifiedTestCases().isEmpty());
this.testSelectorUnderTest.report();
}

@Test
public void testReportForCollector() {
assertEquals("", this.testSelectorUnderTest.report().getReportForCollector());
}
}

0 comments on commit aaec93a

Please sign in to comment.