java.lang.AssertionError

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • h4. Status Quo {{DateTimeFormatterFactory}} provides a {{timeZone}} property; however, this property is currently ignored. This was unfortunately overlooked due to a false positive in the corresponding unit test (i.e., {{DateTimeFormatterFactoryTests.shouldGetWithTimeZone()}}). Specifically, the author of the test and the Spring CI server happen to reside in the same time zone, thereby masking the problem. When {{DateTimeFormatterFactoryTests.shouldGetWithTimeZone()}} is executed in a timezone other than "-0700", the test fails. For example, when executed in timezone "+0200", the test results in the following error. {noformat} java.lang.AssertionError: Expected: is "20091021121000 -0700" but: was "20091021121000 +0200" at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.junit.Assert.assertThat(Assert.java:962) at org.junit.Assert.assertThat(Assert.java:924) at org.springframework.format.datetime.joda.DateTimeFormatterFactoryTests.shouldGetWithTimeZone(DateTimeFormatterFactoryTests.java:98) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:46) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:43) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:270) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:62) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:52) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:307) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) {noformat} h4. Analysis The following is the implementation of {{DateTimeFormatterFactory.getDateTimeFormatter(DateTimeFormatter)}} as of Spring 3.2 RC1. {code} public DateTimeFormatter getDateTimeFormatter(DateTimeFormatter fallbackFormatter) { DateTimeFormatter dateTimeFormatter = createDateTimeFormatter(); if(dateTimeFormatter != null && this.timeZone != null) { dateTimeFormatter.withZone(DateTimeZone.forTimeZone(this.timeZone)); } return (dateTimeFormatter != null ? dateTimeFormatter : fallbackFormatter); } {code} So although {{withZone()}} is invoked, it has no effect. It is therefore assumed that the following was the intended implementation. {code} public DateTimeFormatter getDateTimeFormatter(DateTimeFormatter fallbackFormatter) { DateTimeFormatter dateTimeFormatter = createDateTimeFormatter(); if(dateTimeFormatter != null && this.timeZone != null) { dateTimeFormatter = dateTimeFormatter.withZone(DateTimeZone.forTimeZone(this.timeZone)); } return (dateTimeFormatter != null ? dateTimeFormatter : fallbackFormatter); } {code} However, even with the above change, {{DateTimeFormatterFactoryTests.shouldGetWithTimeZone()}} still fails with the following stack trace. {noformat} java.lang.AssertionError: Expected: is "20091021121000 -0700" but: was "20091021101000 +0000" at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.junit.Assert.assertThat(Assert.java:962) at org.junit.Assert.assertThat(Assert.java:924) at org.springframework.format.datetime.joda.DateTimeFormatterFactoryTests.shouldGetWithTimeZone(DateTimeFormatterFactoryTests.java:98) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:46) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:43) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:270) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:62) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:52) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:307) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) {noformat} h4. Deliverables # (/) Honor the {{timeZone}} property in {{DateTimeFormatterFactory.getDateTimeFormatter(DateTimeFormatter)}} # (/) Rewrite {{DateTimeFormatterFactoryTests.shouldGetWithTimeZone()}} so that it does not test against the default timezone
    via by Sam Brannen,
  • h4. Status Quo {{DateTimeFormatterFactory}} provides a {{timeZone}} property; however, this property is currently ignored. This was unfortunately overlooked due to a false positive in the corresponding unit test (i.e., {{DateTimeFormatterFactoryTests.shouldGetWithTimeZone()}}). Specifically, the author of the test and the Spring CI server happen to reside in the same time zone, thereby masking the problem. When {{DateTimeFormatterFactoryTests.shouldGetWithTimeZone()}} is executed in a timezone other than "-0700", the test fails. For example, when executed in timezone "+0200", the test results in the following error. {noformat} java.lang.AssertionError: Expected: is "20091021121000 -0700" but: was "20091021121000 +0200" at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.junit.Assert.assertThat(Assert.java:962) at org.junit.Assert.assertThat(Assert.java:924) at org.springframework.format.datetime.joda.DateTimeFormatterFactoryTests.shouldGetWithTimeZone(DateTimeFormatterFactoryTests.java:98) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:46) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:43) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:270) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:62) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:52) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:307) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) {noformat} h4. Analysis The following is the implementation of {{DateTimeFormatterFactory.getDateTimeFormatter(DateTimeFormatter)}} as of Spring 3.2 RC1. {code} public DateTimeFormatter getDateTimeFormatter(DateTimeFormatter fallbackFormatter) { DateTimeFormatter dateTimeFormatter = createDateTimeFormatter(); if(dateTimeFormatter != null && this.timeZone != null) { dateTimeFormatter.withZone(DateTimeZone.forTimeZone(this.timeZone)); } return (dateTimeFormatter != null ? dateTimeFormatter : fallbackFormatter); } {code} So although {{withZone()}} is invoked, it has no effect. It is therefore assumed that the following was the intended implementation. {code} public DateTimeFormatter getDateTimeFormatter(DateTimeFormatter fallbackFormatter) { DateTimeFormatter dateTimeFormatter = createDateTimeFormatter(); if(dateTimeFormatter != null && this.timeZone != null) { dateTimeFormatter = dateTimeFormatter.withZone(DateTimeZone.forTimeZone(this.timeZone)); } return (dateTimeFormatter != null ? dateTimeFormatter : fallbackFormatter); } {code} However, even with the above change, {{DateTimeFormatterFactoryTests.shouldGetWithTimeZone()}} still fails with the following stack trace. {noformat} java.lang.AssertionError: Expected: is "20091021121000 -0700" but: was "20091021101000 +0000" at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.junit.Assert.assertThat(Assert.java:962) at org.junit.Assert.assertThat(Assert.java:924) at org.springframework.format.datetime.joda.DateTimeFormatterFactoryTests.shouldGetWithTimeZone(DateTimeFormatterFactoryTests.java:98) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:46) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:43) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:270) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:62) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:52) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:307) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) {noformat} h4. Deliverables # (/) Honor the {{timeZone}} property in {{DateTimeFormatterFactory.getDateTimeFormatter(DateTimeFormatter)}} # (/) Rewrite {{DateTimeFormatterFactoryTests.shouldGetWithTimeZone()}} so that it does not test against the default timezone
    via by Sam Brannen,
  • GitHub comment 5590#30294436
    via GitHub by wildfly-ci
    ,
  • Master@HEAD fails `gradle check`
    via GitHub by utensil
    ,
    • java.lang.AssertionError: Expected: is "20091021121000 -0700" but: was "20091021121000 +0200" at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.junit.Assert.assertThat(Assert.java:962) at org.junit.Assert.assertThat(Assert.java:924) at org.springframework.format.datetime.joda.DateTimeFormatterFactoryTests.shouldGetWithTimeZone(DateTimeFormatterFactoryTests.java:98) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:46) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:43) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:270) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:62) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:52) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:307) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

    Users with the same issue

    marcbouvierdavmarcbouvierdav
    1 times, last one,
    andyglickandyglick
    3 times, last one,
    olle.hallinolle.hallin
    1 times, last one,
    bernardpaulusbernardpaulus
    7 times, last one,
    ivanszkypeterivanszkypeter
    6 times, last one,
    13 more bugmates