junit.framework.AssertionFailedError: Double Weapon count expected:<2> but was:<1>

GitHub | LegacyKing | 1 year ago
  1. 0

    GitHub comment 689#154007148

    GitHub | 1 year ago | LegacyKing
    junit.framework.AssertionFailedError: Double Weapon count expected:<2> but was:<1>
  2. 0

    [JSPWIKI-809] PageCache has hardcoded limit of 1000 and doesn't fail gracefully - ASF JIRA

    apache.org | 1 year ago
    junit.framework.AssertionFailedError: Right number of pages expected:<1001> but was:<1000>
  3. 0

    Summary: if you have "too many" (1000) pages in your Wiki at least in Tomcat 7.0.47 the JSPWiki application fails and stops. This is also reproducible in the unit tests, although there it is not noticed normally at the moment because exactly the (working) boundary condition of 1000 is used. The default for caching is "jspwiki.usePageCache = true". Since 2.10.0-svn-45 a new or at least changed CachingProvider is used. It seems that in jspwiki-war/src/main/java/org/apache/wiki/providers/CachingProvider.java the default "public static final int DEFAULT_CACHECAPACITY = 1000; // Good most wikis" is always used, even if lower or higher values are used in ehcache.xml. Or perhaps the default ehcache.xml is in the wrong location to be used. Steps to reproduce (version 2.10.0-svn-60 is used): mvn -e test -Dtest=MassiveRepositoryTest -DfailIfNoTests=false The "-DfailIfNoTests=false" is necessary in this case because otherwise we get a test failure for jspwiki-pages-de. Possibly a bug in the test setup but otherwise uninteresting. The test succeeds. Now edit jspwiki-war/src/test/java/org/apache/wiki/stress/MassiveRepositoryTest.java and on line 78 edit the line "int numPages = 1000;" and set numPages to a value of 1001. Rerun the test which now fails. ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.apache.wiki.stress.MassiveRepositoryTest Creating 1001 pages ..................................................................................................... Took 0:00:08.858, which is 113.00519304583428 adds/second Checking in 1000 revisions .................................................................................................... Took 0:00:06.360, which is 157.2327044025157 adds/second Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 16.262 sec <<< FAILURE! - in org.apache.wiki.stress.MassiveRepositoryTest testMassiveRepository1(org.apache.wiki.stress.MassiveRepositoryTest) Time elapsed: 16.198 sec <<< FAILURE! junit.framework.AssertionFailedError: Right number of pages expected:<1001> but was:<1000> at junit.framework.Assert.fail(Assert.java:57) at junit.framework.Assert.failNotEquals(Assert.java:329) at junit.framework.Assert.assertEquals(Assert.java:78) at junit.framework.Assert.assertEquals(Assert.java:234) at junit.framework.TestCase.assertEquals(TestCase.java:401) at org.apache.wiki.stress.MassiveRepositoryTest.testMassiveRepository1(MassiveRepositoryTest.java:134) Results : Failed tests: MassiveRepositoryTest.testMassiveRepository1:134 Right number of pages expected:<1001> but was:<1000> Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 Perhaps the number 1000 was hardcoded in the test itself? Nope, if we change numPages to 999 and rerun the test it succeeds. Editing jspwiki-war/src/main/resources/ehcache.xml and changing all values of 1000 there to 100 still makes the test succeed with numPages set to 1000 and fails with 1001. If we however in jspwiki-war/src/main/java/org/apache/wiki/providers/CachingProvider.java edit line 92, shown below public static final int DEFAULT_CACHECAPACITY = 1000; // Good most wikis to 999, then the test succeeds with numPages at 999 (or lower) and fails with numPages at 1000 (or higher). Disabling the caching in jspwiki-war/src/test/resources/jspwiki-vers-custom.properties by setting jspwiki.usePageCache = false makes the tests succeed, even beyond the limit at 1000. And this is also the workaround if your Wiki has a large number of pages. In reality what exactly is the limit is less clear. I have a single Tomcat instance with eight JSPWiki applications and also eight separate pageDir repositories. The larger ones "crash" (get stopped by Tomcat), but some crash even with "only" 345 pages. The following is the only thing that gets logged in catalina.out. dec 29, 2013 10:00:53 AM org.apache.catalina.loader.WebappClassLoader loadClass INFO: Illegal access: this web application instance has been stopped already. Could not load net.sf.ehcache.util.ProductInfo. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1588) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) at net.sf.ehcache.util.UpdateChecker.buildParamsString(UpdateChecker.java:133) at net.sf.ehcache.util.UpdateChecker.buildUpdateCheckUrl(UpdateChecker.java:123) at net.sf.ehcache.util.UpdateChecker.doCheck(UpdateChecker.java:68) at net.sf.ehcache.util.UpdateChecker.checkForUpdate(UpdateChecker.java:60) at net.sf.ehcache.util.UpdateChecker.run(UpdateChecker.java:51) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505) These same repositories had no caching problems with version 2.10.0-svn-15. As an easy workaround exists (disabling cache) this is in my very humble opinion no showstopper. Perhaps the fact a limit exists and especially that the failure if you happen to stumble beyond isn't very clearly reported as an error message, could be documented somewhere. Also it might be nice to be able to configure the limit as a property. This doesn't seem to be possible at the moment?

    Apache's JIRA Issue Tracker | 3 years ago | Marco Roeland
    junit.framework.AssertionFailedError: Right number of pages expected:<1001> but was:<1000>
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Time: 175.659 There was 1 failure: 1) basicTest(water.TimelineTest) junit.framework.AssertionFailedError: some msgs are missing from the timeline: [SEND /172.16.2.173:43016 -> /172.16.2.173:43004, RECV /172.16.2.173:43016 -> /172.16.2.173:43010, RECV /172.16.2.173:43016 -> /172.16.2.173:43012, RECV /172.16.2.173:43014 -> /172.16.2.173:43010, RECV /172.16.2.173:43014 -> /172.16.2.173:43012, RECV /172.16.2.173:43010 -> /172.16.2.173:43004, RECV /172.16.2.173:43014 -> /172.16.2.173:43016, RECV /172.16.2.173:43016 -> /172.16.2.173:43014, SEND /172.16.2.173:43012 -> /172.16.2.173:43004, SEND /172.16.2.173:43014 -> /172.16.2.173:43004, RECV /172.16.2.173:43012 -> /172.16.2.173:43004, SEND /172.16.2.173:43010 -> /172.16.2.173:43016, SEND /172.16.2.173:43010 -> /172.16.2.173:43014, SEND /172.16.2.173:43010 -> /172.16.2.173:43012, RECV /172.16.2.173:43004 -> /172.16.2.173:43010, RECV /172.16.2.173:43004 -> /172.16.2.173:43012, RECV /172.16.2.173:43004 -> /172.16.2.173:43014, RECV /172.16.2.173:43004 -> /172.16.2.173:43016, SEND /172.16.2.173:43014 -> /172.16.2.173:43010, SEND /172.16.2.173:43014 -> /172.16.2.173:43012, RECV /172.16.2.173:43002 -> /172.16.2.173:43004, RECV /172.16.2.173:43000 -> /172.16.2.173:43004, SEND /172.16.2.173:43012 -> /172.16.2.173:43010, SEND /172.16.2.173:43012 -> /172.16.2.173:43014, RECV /172.16.2.173:43010 -> /172.16.2.173:43016, SEND /172.16.2.173:43016 -> /172.16.2.173:43010, SEND /172.16.2.173:43012 -> /172.16.2.173:43016, SEND /172.16.2.173:43016 -> /172.16.2.173:43012, RECV /172.16.2.173:43014 -> /172.16.2.173:43004, SEND /172.16.2.173:43014 -> /172.16.2.173:43016, RECV /172.16.2.173:43016 -> /172.16.2.173:43004, SEND /172.16.2.173:43016 -> /172.16.2.173:43014, RECV /172.16.2.173:43008 -> /172.16.2.173:43004, SEND /172.16.2.173:43004 -> /172.16.2.173:43010, SEND /172.16.2.173:43010 -> /172.16.2.173:43004, RECV /172.16.2.173:43012 -> /172.16.2.173:43016, SEND /172.16.2.173:43004 -> /172.16.2.173:43012, RECV /172.16.2.173:43012 -> /172.16.2.173:43014, RECV /172.16.2.173:43010 -> /172.16.2.173:43014, RECV /172.16.2.173:43010 -> /172.16.2.173:43012, RECV /172.16.2.173:43012 -> /172.16.2.173:43010, SEND /172.16.2.173:43004 -> /172.16.2.173:43014, RECV /172.16.2.173:43006 -> /172.16.2.173:43004, SEND /172.16.2.173:43004 -> /172.16.2.173:43016] expected:<44> but was:<40> at junit.framework.Assert.fail(Assert.java:57) at junit.framework.Assert.failNotEquals(Assert.java:329) at junit.framework.Assert.assertEquals(Assert.java:78) at junit.framework.Assert.assertEquals(Assert.java:234) at junit.framework.TestCase.assertEquals(TestCase.java:401) at water.TimelineTest.basicTest(TimelineTest.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at water.TestUtil$2$TimerStatement.evaluate(TestUtil.java:90) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runners.Suite.runChild(Suite.java:127) at org.junit.runners.Suite.runChild(Suite.java:26) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at org.junit.runner.JUnitCore.run(JUnitCore.java:138) at org.junit.runner.JUnitCore.run(JUnitCore.java:117) at water.junit.H2OTestRunner.run(H2OTestRunner.java:44) at water.junit.H2OTestRunner.main(H2OTestRunner.java:53) FAILURES!!! Tests run: 232, Failures: 1

    JIRA | 2 years ago | Neeraja Madabhushi
    junit.framework.AssertionFailedError: some msgs are missing from the timeline: [SEND /172.16.2.173:43016 -> /172.16.2.173:43004, RECV /172.16.2.173:43016 -> /172.16.2.173:43010, RECV /172.16.2.173:43016 -> /172.16.2.173:43012, RECV /172.16.2.173:43014 -> /172.16.2.173:43010, RECV /172.16.2.173:43014 -> /172.16.2.173:43012, RECV /172.16.2.173:43010 -> /172.16.2.173:43004, RECV /172.16.2.173:43014 -> /172.16.2.173:43016, RECV /172.16.2.173:43016 -> /172.16.2.173:43014, SEND /172.16.2.173:43012 -> /172.16.2.173:43004, SEND /172.16.2.173:43014 -> /172.16.2.173:43004, RECV /172.16.2.173:43012 -> /172.16.2.173:43004, SEND /172.16.2.173:43010 -> /172.16.2.173:43016, SEND /172.16.2.173:43010 -> /172.16.2.173:43014, SEND /172.16.2.173:43010 -> /172.16.2.173:43012, RECV /172.16.2.173:43004 -> /172.16.2.173:43010, RECV /172.16.2.173:43004 -> /172.16.2.173:43012, RECV /172.16.2.173:43004 -> /172.16.2.173:43014, RECV /172.16.2.173:43004 -> /172.16.2.173:43016, SEND /172.16.2.173:43014 -> /172.16.2.173:43010, SEND /172.16.2.173:43014 -> /172.16.2.173:43012, RECV /172.16.2.173:43002 -> /172.16.2.173:43004, RECV /172.16.2.173:43000 -> /172.16.2.173:43004, SEND /172.16.2.173:43012 -> /172.16.2.173:43010, SEND /172.16.2.173:43012 -> /172.16.2.173:43014, RECV /172.16.2.173:43010 -> /172.16.2.173:43016, SEND /172.16.2.173:43016 -> /172.16.2.173:43010, SEND /172.16.2.173:43012 -> /172.16.2.173:43016, SEND /172.16.2.173:43016 -> /172.16.2.173:43012, RECV /172.16.2.173:43014 -> /172.16.2.173:43004, SEND /172.16.2.173:43014 -> /172.16.2.173:43016, RECV /172.16.2.173:43016 -> /172.16.2.173:43004, SEND /172.16.2.173:43016 -> /172.16.2.173:43014, RECV /172.16.2.173:43008 -> /172.16.2.173:43004, SEND /172.16.2.173:43004 -> /172.16.2.173:43010, SEND /172.16.2.173:43010 -> /172.16.2.173:43004, RECV /172.16.2.173:43012 -> /172.16.2.173:43016, SEND /172.16.2.173:43004 -> /172.16.2.173:43012, RECV /172.16.2.173:43012 -> /172.16.2.173:43014, RECV /172.16.2.173:43010 -> /172.16.2.173:43014, RECV /172.16.2.173:43010 -> /172.16.2.173:43012, RECV /172.16.2.173:43012 -> /172.16.2.173:43010, SEND /172.16.2.173:43004 -> /172.16.2.173:43014, RECV /172.16.2.173:43006 -> /172.16.2.173:43004, SEND /172.16.2.173:43004 -> /172.16.2.173:43016] expected:<44> but was:<40>
  6. 0

    Android JUnit test for ArrayAdapter throw NullPointerException

    Stack Overflow | 6 months ago | RLim
    junit.framework.AssertionFailedError: Contacts amount incorrect. Expected :2 Actual :0 <Click to see difference>

    1 unregistered visitors
    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

      Double Weapon count expected:<2> but was:<1>

      at junit.framework.Assert.fail()
    2. JUnit
      TestCase.assertEquals
      1. junit.framework.Assert.fail(Assert.java:57)
      2. junit.framework.Assert.failNotEquals(Assert.java:329)
      3. junit.framework.Assert.assertEquals(Assert.java:78)
      4. junit.framework.Assert.assertEquals(Assert.java:234)
      5. junit.framework.TestCase.assertEquals(TestCase.java:401)
      5 frames
    3. pcgen.gui2.facade
      EquipmentSetFacadeImplTest.testSlotCreation
      1. pcgen.gui2.facade.EquipmentSetFacadeImplTest.testSlotCreation(EquipmentSetFacadeImplTest.java:258)
      1 frame