Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nullpointer exception when reporting with TakeAllSelector #947

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
* c.e.brandt@tudelft.nl
* 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());
}
}