junit.framework.AssertionFailedError: Expected: <null> but was: file:/srv/ciagent/workspace/PLF/ws-develop-sonar/exo.ws.rest.ext/target/test-classes/repo/MyClass.groovy

JIRA | Maxime Gréau | 4 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    The following Unit Test {{org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoaderTest#testLoadGroovySource}} fails when it is executing twice without clean up between the 2 executions. 1st time: ---- {code:java} $ mvn test -Dtest=DefaultGroovyResourceLoaderTest [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building eXo PLF:: WS :: REST :: Extentions 2.6.x-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-java-version) @ exo.ws.rest.ext --- [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven-version) @ exo.ws.rest.ext --- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ exo.ws.rest.ext --- [debug] execute contextualize [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ exo.ws.rest.ext --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-antrun-plugin:1.6:run (default) @ exo.ws.rest.ext --- [INFO] Executing tasks main: [echo] Java Vendor System Prop: Oracle Corporation [echo] Java Version System Prop: 1.8.0_92 [INFO] Executed tasks [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ exo.ws.rest.ext --- [debug] execute contextualize [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 9 resources [INFO] [INFO] --- maven-antrun-plugin:1.6:run (create-tmp-dir) @ exo.ws.rest.ext --- [WARNING] Parameter tasks is deprecated, use target instead [INFO] Executing tasks main: [INFO] Executed tasks [INFO] [INFO] --- maven-antrun-plugin:1.6:run (prepare-test-policy) @ exo.ws.rest.ext --- [INFO] Executing tasks main: [echo] Creating Access Policy for tests [copy] Copying 1 file to /srv/ciagent/workspace/target/test-classes [INFO] Executed tasks [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ exo.ws.rest.ext --- [INFO] Compiling 1 source file to /srv/ciagent/workspace/target/test-classes [INFO] [INFO] --- maven-surefire-plugin:2.17:test (default-test) @ exo.ws.rest.ext --- [INFO] Surefire report directory: /srv/ciagent/workspace/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoaderTest A file 'tsm-excludes.properties' has been found 09.01.2017 09:49:17 *INFO * [main] StandaloneContainer: StandaloneContainer initialized using: file:/srv/ciagent/workspace/src/test/resources/conf/standalone/test-configuration.xml (StandaloneContainer.java, line 200) Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 9.824 sec - in org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoaderTest Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 16.177s [INFO] Finished at: Mon Jan 09 09:49:21 UTC 2017 [INFO] Final Memory: 19M/990M [INFO] ------------------------------------------------------------------------ {code} 2nd time (no clean before) ---- {code:java} $ mvn test -Dtest=DefaultGroovyResourceLoaderTest [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building eXo PLF:: WS :: REST :: Extentions 2.6.x-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-java-version) @ exo.ws.rest.ext --- [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven-version) @ exo.ws.rest.ext --- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ exo.ws.rest.ext --- [debug] execute contextualize [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ exo.ws.rest.ext --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-antrun-plugin:1.6:run (default) @ exo.ws.rest.ext --- [INFO] Executing tasks main: [echo] Java Vendor System Prop: Oracle Corporation [echo] Java Version System Prop: 1.8.0_92 [INFO] Executed tasks [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ exo.ws.rest.ext --- [debug] execute contextualize [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 9 resources [INFO] [INFO] --- maven-antrun-plugin:1.6:run (create-tmp-dir) @ exo.ws.rest.ext --- [WARNING] Parameter tasks is deprecated, use target instead [INFO] Executing tasks main: [INFO] Executed tasks [INFO] [INFO] --- maven-antrun-plugin:1.6:run (prepare-test-policy) @ exo.ws.rest.ext --- [INFO] Executing tasks main: [echo] Creating Access Policy for tests [copy] Copying 1 file to /srv/ciagent/workspace/target/test-classes [INFO] Executed tasks [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ exo.ws.rest.ext --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.17:test (default-test) @ exo.ws.rest.ext --- [INFO] Surefire report directory: /srv/ciagent/workspace/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoaderTest A file 'tsm-excludes.properties' has been found 09.01.2017 09:49:37 *INFO * [main] StandaloneContainer: StandaloneContainer initialized using: file:/srv/ciagent/workspace/src/test/resources/conf/standalone/test-configuration.xml (StandaloneContainer.java, line 200) Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 11.562 sec <<< FAILURE! - in org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoaderTest testLoadGroovySource(org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoaderTest) Time elapsed: 11.06 sec <<< FAILURE! junit.framework.AssertionFailedError: Expected: <null> but was: file:/srv/ciagent/workspace/target/test-classes/repo/MyClass.groovy at junit.framework.Assert.fail(Assert.java:50) at junit.framework.Assert.assertTrue(Assert.java:20) at junit.framework.Assert.assertNull(Assert.java:237) at junit.framework.Assert.assertNull(Assert.java:230) at org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoaderTest.testLoadGroovySource(DefaultGroovyResourceLoaderTest.java:47) Results : Failed tests: DefaultGroovyResourceLoaderTest.testLoadGroovySource:47 Expected: <null> but was: file:/srv/ciagent/workspace/target/test-classes/repo/MyClass.groovy Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 17.350s [INFO] Finished at: Mon Jan 09 09:49:41 UTC 2017 [INFO] Final Memory: 21M/990M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project exo.ws.rest.ext: There are test failures. [ERROR] [ERROR] Please refer to /srv/ciagent/workspace/target/surefire-reports for the individual test results. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException {code} It's due to the fact that this UT creates a file on the filesystem and doesn't delete it at the end of the test. There is no error on CI jobs but the sonar jobs fails because of that: * https://ci.exoplatform.org/job/PLF/view/sonar/job/ws-develop-sonar/50/console {code:java} testLoadGroovySource(org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoaderTest) Time elapsed: 0.024 sec <<< FAILURE! junit.framework.AssertionFailedError: Expected: <null> but was: file:/srv/ciagent/workspace/PLF/ws-develop-sonar/exo.ws.rest.ext/target/test-classes/repo/MyClass.groovy at junit.framework.Assert.fail(Assert.java:50) at junit.framework.Assert.assertTrue(Assert.java:20) at junit.framework.Assert.assertNull(Assert.java:237) at junit.framework.Assert.assertNull(Assert.java:230) at org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoaderTest.testLoadGroovySource(DefaultGroovyResourceLoaderTest.java:47) Running org.exoplatform.services.rest.ext.groovy.GroovyExoComponentTest Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.126 sec - in org.exoplatform.services.rest.ext.groovy.GroovyExoComponentTest Running org.exoplatform.services.rest.ext.provider.HierarchicalPropertyEntityProviderTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.019 sec - in org.exoplatform.services.rest.ext.provider.HierarchicalPropertyEntityProviderTest Running org.exoplatform.services.rest.ext.filter.UriNormalizationFilterTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 sec - in org.exoplatform.services.rest.ext.filter.UriNormalizationFilterTest Results : Failed tests: DefaultGroovyResourceLoaderTest.testLoadGroovySource:47 Expected: <null> but was: file:/srv/ciagent/workspace/PLF/ws-develop-sonar/exo.ws.rest.ext/target/test-classes/repo/MyClass.groovy Tests run: 13, Failures: 1, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] eXo PLF:: WS ...................................... SUCCESS [3.237s] [INFO] eXo PLF:: WS :: Commons Utils ..................... SUCCESS [18.573s] [INFO] eXo PLF:: WS :: Framework :: JSON ................. SUCCESS [7.018s] [INFO] eXo PLF:: WS :: Framework :: Servlet .............. SUCCESS [2.108s] [INFO] eXo PLF:: WS :: HTTP :: testframework ............. SUCCESS [1.332s] [INFO] eXo PLF:: WS :: REST :: Core ...................... SUCCESS [23.842s] [INFO] eXo PLF:: WS :: REST :: Extentions ................ FAILURE [9.666s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1:06.592s [INFO] Finished at: Sun Jan 08 08:11:59 UTC 2017 [INFO] Final Memory: 56M/957M [INFO] ------------------------------------------------------------------------ {code}

    JIRA | 4 months ago | Maxime Gréau
    junit.framework.AssertionFailedError: Expected: <null> but was: file:/srv/ciagent/workspace/PLF/ws-develop-sonar/exo.ws.rest.ext/target/test-classes/repo/MyClass.groovy
  2. 0

    Java Generic Cast Error

    Stack Overflow | 2 years ago | aurélien lemaitre
    junit.framework.AssertionFailedError: Expected: <null> but was: com.test.MyTest$C@5c228bbd
  3. 0

    Fatal Exception: Junit.framework.assertionfailederror

    Stack Overflow | 10 months ago | Hassanova
    junit.framework.AssertionFailedError: Expected: <null> but was: Handler (android.webkit.WebViewCore$WebCoreThread$1) {42523ba8}
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [TEST-FAILURE] InternalPartitionServiceLiteMemberTest.test_getPartitionOwnerOrWait_onLiteMemberAfterDataMemberShutsDown

    GitHub | 2 years ago | hasancelik
    java.lang.Exception: Unexpected exception, expected<com.hazelcast.partition.NoDataMemberInClusterException> but was<junit.framework.AssertionFailedError>

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. junit.framework.AssertionFailedError

      Expected: <null> but was: file:/srv/ciagent/workspace/PLF/ws-develop-sonar/exo.ws.rest.ext/target/test-classes/repo/MyClass.groovy

      at junit.framework.Assert.fail()
    2. JUnit
      Assert.assertNull
      1. junit.framework.Assert.fail(Assert.java:50)
      2. junit.framework.Assert.assertTrue(Assert.java:20)
      3. junit.framework.Assert.assertNull(Assert.java:237)
      4. junit.framework.Assert.assertNull(Assert.java:230)
      4 frames
    3. org.exoplatform.services
      DefaultGroovyResourceLoaderTest.testLoadGroovySource
      1. org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoaderTest.testLoadGroovySource(DefaultGroovyResourceLoaderTest.java:47)
      1 frame