Don’t get it why CookieTests are failing? (Java 11...
# http4k
d
Don’t get it why CookieTests are failing? (Java 11 and german locale settings).
Copy code
CookieTest > cookie with various expires date formats parsed() FAILED
    java.lang.AssertionError at CookieTest.kt:215

ClientCookiesTest > cookie expiry uses the same timezone as cookie parsing() FAILED
    java.lang.NullPointerException at ClientCookiesTest.kt:88
When I run only “CookieTest > cookie with various expires date formats parsed()” test is passing - but running all tests it’s always failing. Any Ideas?
v
note that gradle might run tests in several threads according to your cpu - so if any of the tests use static variables or mock static fields, the tests might influence each other. i usually use
Copy code
tasks.test {
        // Gradle forks tests according to available cores, so the test might run differently on different machines.
        // This is to prevent failures with static mocks. Also one must make sure to call @AfterEach[clearAllMocks, unmockkAll].
        maxParallelForks = 1
    }
to prevent that
d
oh forgotten to mention I just cloned http4k repository and tried ./gradlew clean build where result was two failing tests.
s
@DanielZ thank you for spotting this. Can you please open an issue so we don’t loose track of it? I’ll try and investigate as well as soon as I get a chance
d
@s4nchez sure I can do this. Was first thinking about I do some stupid mistake 😊
s
From what you’ve described, most likely we’ve made a stupid mistake 😜 and because it may be related to timezones, it’s likely to be annoying to reproduce
Well, that was easy enough to reproduce (on a mac is just a case of changing Region/Language in system preferences). Now I just need to find a fix...
@DanielZ that should not be fixed on master. Please pull and give it another try. Also, If you let me know your github user I can give you credit in the changelog 🙂
d
@s4nchez wow you where faster then raising me an issue 😳 Yes it’s working now 😊 Thanks for the quick fix! (There are only two println() left in Cookie.kt) My github account is dzappold (https://github.com/dzappold/).
s
All done. The change will be out on the next minor release. Thank you again for spotting it 🙂
👍 1