Dave12345
Dave12345
JCHJava Community | Help. Code. Learn.
Created by Dave12345 on 12/26/2024 in #java-help
JUnit succeeds when run as "debug as junit test" but fails as "debug as gradle test".
I'm doing a simple hibernate test and the code all works fine when run from Eclipse normally as well as when I create a junit to test it. But I'm now trying to run as ./gradlew test (from bash or within eclipse) and I'm having a problem with: em.persist(jazz); causing: org.opentest4j.AssertionFailedError: Unexpected exception thrown: java.lang.IllegalArgumentException: Unable to locate persister: entities.Genre There must be some config or context which is missing from the gradle test which is generally present.
38 replies
JCHJava Community | Help. Code. Learn.
Created by Dave12345 on 12/22/2024 in #java-help
Guice with empty Module
I'm learning Guice and I have working code, but my Module (extending AbstractModule) is empty (because I'm injecting a class not an interface). I can see that there's no overload of Guice.createInjector() which takes no params. Is there some way of not needing a module in my scenario? Not sure if: 1) it's not a big deal; you might add bindings to it later 2) using Guice with an empty module is an anti-pattern - always use interfaces (but I don't think that's correct) 3) I'm missing something.
25 replies