mulesoft-catalyst / error-handler-plugin

The Unlicense
35 stars 54 forks source link

[Mule 4.4] Code Coverage fails to run when using this plugin #14

Closed amritsinghbainsmulesoft closed 1 year ago

amritsinghbainsmulesoft commented 2 years ago
app runtime: 4.4.0-20220124
runtimeVersion: 4.4.0-20220124

I get a null pointer exception when I run munit tests when including this library in my mule 4.4 project. The tests pass but code coverage is not produced.

Exception in thread "pool-6-thread-1" java.lang.NullPointerException
    at org.mule.munit.plugins.coverage.core.model.CoverageTypedComponentIdentifier.hashCode(CoverageTypedComponentIdentifier.java:66)
    at java.util.Objects.hashCode(Objects.java:98)
    at java.util.Optional.hashCode(Optional.java:329)
    at org.mule.munit.plugins.coverage.core.model.CoverageLocationPart.hashCode(CoverageLocationPart.java:102)
    at java.util.AbstractList.hashCode(AbstractList.java:541)
    at java.util.Collections$UnmodifiableList.hashCode(Collections.java:1309)
    at org.mule.munit.plugins.coverage.core.model.CoverageComponentLocation.hashCode(CoverageComponentLocation.java:192)
    at java.util.HashMap.hash(HashMap.java:339)
    at java.util.HashMap.put(HashMap.java:612)
    at java.util.HashSet.add(HashSet.java:220)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:83)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
    at com.google.gson.Gson.fromJson(Gson.java:932)
    at com.google.gson.Gson.fromJson(Gson.java:897)
    at com.google.gson.Gson.fromJson(Gson.java:846)
    at com.google.gson.Gson.fromJson(Gson.java:817)
    at org.mule.munit.plugins.coverage.server.CoverageMessageParser.run(CoverageMessageParser.java:41)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
amritsinghbainsmulesoft commented 2 years ago
================================================================================
= Tests run: 6 - Failed: 0 - Errors: 0 - Skipped: 0 - Time elapsed: 14.25 sec  =
================================================================================
INFO  2022-02-25 11:37:15,031 [munit.01] org.mule.munit.runner.remote.api.server.RunnerServer: Waiting for client connection 
INFO  2022-02-25 11:37:15,032 [Embedded] org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer: ================== Request to Undeploy Artifact: mulesoft_salesforce_sapi
INFO  2022-02-25 11:37:15,082 [Embedded] org.mule.runtime.core.internal.logging.LogUtil: 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Stopping application 'mulesoft_salesforce_sapi'                       +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO  2022-02-25 11:37:15,082 [pool-6-thread-1] org.mule.munit.remote.coverage.CoverageManager: accumulating covered locations
Exception in thread "pool-7-thread-1" java.lang.NullPointerException
    at org.mule.munit.plugins.coverage.core.model.CoverageTypedComponentIdentifier.hashCode(CoverageTypedComponentIdentifier.java:66)
    at java.util.Objects.hashCode(Objects.java:98)
    at java.util.Optional.hashCode(Optional.java:329)
    at org.mule.munit.plugins.coverage.core.model.CoverageLocationPart.hashCode(CoverageLocationPart.java:102)
    at java.util.AbstractList.hashCode(AbstractList.java:541)
    at java.util.Collections$UnmodifiableList.hashCode(Collections.java:1309)
    at org.mule.munit.plugins.coverage.core.model.CoverageComponentLocation.hashCode(CoverageComponentLocation.java:192)
    at java.util.HashMap.hash(HashMap.java:339)
    at java.util.HashMap.put(HashMap.java:612)
    at java.util.HashSet.add(HashSet.java:220)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:83)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
INFO  2022-02-25 11:37:15,084 [Embedded] org.mule.runtime.core.privileged.lifecycle.AbstractLifecycleManager: Stopping Bean: org.mule.runtime.module.extension.internal.runtime.config.ConfigurationProviderToolingAdapter-json-logger-config
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
    at com.google.gson.Gson.fromJson(Gson.java:932)
    at com.google.gson.Gson.fromJson(Gson.java:897)
    at com.google.gson.Gson.fromJson(Gson.java:846)
    at com.google.gson.Gson.fromJson(Gson.java:817)
    at org.mule.munit.plugins.coverage.server.CoverageMessageParser.run(CoverageMessageParser.java:41)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
INFO  2022-02-25 11:37:15,084 [Embedded] org.mule.runtime.core.privileged.lifecycle.AbstractLifecycleManager: Stopping Bean: org.mule.runtime.module.extension.internal.runtime.config.ConfigurationProviderToolingAdapter-Salesforce_Config
INFO  2022-02-25 11:37:15,087 [Embedded] org.mule.runtime.core.internal.lifecycle.RegistryLifecycleCallback: Failure executing phase stop over object DefaultBatchEngine, error is: org.mule.runtime.api.lifecycle.LifecycleException(Failed to invoke lifecycle phase "stop" on object: com.mulesoft.mule.runtime.module.batch.internal.engine.DefaultBatchEngine@393a9976)
INFO  2022-02-25 11:37:15,094 [Embedded] org.mule.runtime.core.internal.logging.LogUtil:
rajeshanbarasu commented 2 years ago

@amritsinghbainsmulesoft I had the same issue. I have updated the following dependency version in my application to resolve the issue

  1. munit - 2.3.9
  2. mule runtime - 4.4.0-20220221 (update minMuleVersion in mule-artifact.json as well)
sf-charles commented 1 year ago

MUnit issue that is resolved. Not issue with this module.