Adds a test to the OPAL plug-in for the case of NullPointerException. Check out the method of the test for more info.
@@ -118,6 +118,21 @@ public class OPALPluginTest {
assertFalse(opalPlugin.recordProcessSuccessful());
}
+ @Test
+ public void testNullPointerException() {
+ JSONObject mvnCoordinate = new JSONObject("{\n" +
+ " \"groupId\": \"ch.epfl.scala\",\n" +
+ " \"artifactId\": \"collection-strawman_0.6\",\n" +
+ " \"version\": \"0.8.0\",\n" +
+ " \"date\":\"1521511260\"\n" +
+ "}");
+
+ opalPlugin.consume(new ConsumerRecord<>(topic, 1, 0, "bar", mvnCoordinate.toString()), false);
+ // TODO: An assert is pointless here. Because we need to find the root cause of the NullPointerException in PartialCallGraph class.
+ // This test shows that FASTEN URIs of a type's methods can be null! Check out the method toListOfString in ExtendedRevisionCallGraph class.
+ // The described problem is patched at the very high level with a if block!
+ }
+
@Test
public void testProducerTopic() {
assertEquals("opal_callgraphs", opalPlugin.producerTopic());
