pardom
10/12/2017, 4:34 PMError:The 'java' plugin has been applied, but it is not compatible with the Android plugins.
pardom
10/12/2017, 4:34 PMmkporwit
10/16/2017, 2:51 AMclass ProfileHandlerSpec: Spek({
given("a profile handler") {
val ph = ProfileHandler(userProfileRedis)
val uuid = UUID.randomUUID().toString()
val cTime = Date.from(Instant.now()).time
on("new profile creation") {
val profile = ph.createNewUserProfile(UserProfile(uuid, "Hoylu", "User", "<mailto:testuser@hoylu.com|testuser@hoylu.com>"))
it("should create a profile with the proper uuid, creationTime, and default lastLoginTime") {
assertEquals(uuid, profile.uuid)
assertTrue(profile.creationTime >= cTime)
assertEquals(0L, profile.lastLoginInfo.lastLoginTime)
}
on("fetching a profile") {
val gotProfile = ph.getUserProfile(profile.uuid)
it("should return the profile for the uuid") {
assertEquals(profile, gotProfile)
}
}
}
}
})
Which fails to execute. IntelliJ complains that there are no runnable methods:
java.lang.Exception: No runnable methods
at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:191)
at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:128)
at org.junit.runners.ParentRunner.validate(ParentRunner.java:416)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:84)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:65)
at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
I've got spek
configured in my build.gradle:
junitPlatform {
filters {
engines {
include 'spek'
}
}
}
dave08
10/16/2017, 6:20 AMmkporwit
10/16/2017, 6:25 AMmkporwit
10/16/2017, 6:28 AMprofile
in subsequent on
blocks w/o making profile a var
inside the given
raniejade
10/16/2017, 6:29 AM@RunWith(JUnitPlatfom::class.java)
.raniejade
10/16/2017, 6:31 AMorg.junit.platform:junit-platform-runner
on your classpath since you’re using JUnit4.mkporwit
10/16/2017, 6:31 AMmkporwit
10/16/2017, 6:31 AMraniejade
10/16/2017, 6:32 AMmkporwit
10/16/2017, 6:34 AMraniejade
10/16/2017, 6:37 AMorg.junit.platform:junit-platform-launcher
in your classpath and the plugin will use that.mkporwit
10/16/2017, 6:41 AMjava.lang.NoClassDefFoundError: Could not initialize class lu.hoy.eng.userprofile.ProfileHandlerSpecKt
at lu.hoy.eng.userprofile.ProfileHandlerSpec$1$1.invoke(ProfileHandlerSpec.kt:19)
at lu.hoy.eng.userprofile.ProfileHandlerSpec$1$1.invoke(ProfileHandlerSpec.kt:17)
at org.jetbrains.spek.engine.SpekTestEngine$Collector.group(SpekTestEngine.kt:160)
at org.jetbrains.spek.api.dsl.SpecBody$DefaultImpls.group$default(SpecBody.kt:13)
at org.jetbrains.spek.api.dsl.StandardKt.given(Standard.kt:30)
at lu.hoy.eng.userprofile.ProfileHandlerSpec$1.invoke(ProfileHandlerSpec.kt:18)
at lu.hoy.eng.userprofile.ProfileHandlerSpec$1.invoke(ProfileHandlerSpec.kt:17)
at org.jetbrains.spek.engine.SpekTestEngine.resolveSpec(SpekTestEngine.kt:121)
at org.jetbrains.spek.engine.SpekTestEngine.resolveSpecs(SpekTestEngine.kt:80)
at org.jetbrains.spek.engine.SpekTestEngine.discover(SpekTestEngine.kt:50)
at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:130)
at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:117)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
at org.junit.platform.runner.JUnitPlatform.run(JUnitPlatform.java:133)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
mkporwit
10/16/2017, 6:43 AMjunit-platform-launcher
is a testRuntime
dependency for gradle?raniejade
10/16/2017, 6:43 AMmkporwit
10/16/2017, 6:44 AMjunit-platform-runner
testCompile
dependency?raniejade
10/16/2017, 6:44 AMmkporwit
10/16/2017, 6:45 AMmkporwit
10/16/2017, 6:45 AMraniejade
10/16/2017, 6:45 AMmkporwit
10/16/2017, 6:46 AMraniejade
10/16/2017, 6:46 AMmkporwit
10/16/2017, 6:46 AMraniejade
10/16/2017, 6:46 AMmkporwit
10/16/2017, 6:46 AMraniejade
10/16/2017, 6:47 AMmkporwit
10/16/2017, 6:47 AMmkporwit
10/16/2017, 6:47 AMraniejade
10/16/2017, 6:48 AM@RunWith(...)
.