Kotlin testing - JUnit 5, MockK, Kotest, coroutine testing
Generates Kotlin unit tests with JUnit 5, MockK, and coroutine testing patterns.
/plugin marketplace add pluginagentmarketplace/custom-plugin-kotlin/plugin install kotlin-assistant@pluginagentmarketplace-kotlinThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/config.yamlassets/schema.jsonreferences/GUIDE.mdreferences/PATTERNS.mdscripts/validate.pyComprehensive testing with JUnit 5, MockK, and coroutine testing.
class UserServiceTest {
private val repository: UserRepository = mockk()
private val service = UserService(repository)
@Test
fun `createUser saves and returns`() {
every { repository.save(any()) } returns User(1, "test@test.com")
val result = service.create(CreateUserRequest("test@test.com"))
assertThat(result.id).isEqualTo(1)
verify(exactly = 1) { repository.save(any()) }
}
}
@Test
fun `loadUser emits states`() = runTest {
coEvery { repository.getUser(1) } returns Result.success(user)
viewModel.state.test {
viewModel.load(1)
assertThat(awaitItem().isLoading).isTrue()
advanceUntilIdle()
assertThat(awaitItem().user).isEqualTo(user)
}
}
@Test
fun `button enabled when fields filled`() {
composeTestRule.setContent { LoginScreen() }
composeTestRule.onNodeWithTag("email").performTextInput("a@b.com")
composeTestRule.onNodeWithTag("password").performTextInput("pass")
composeTestRule.onNodeWithTag("login_button").assertIsEnabled()
}
| Issue | Resolution |
|---|---|
| "no answer found" | Add every { } returns for method |
| Test hangs | Inject TestDispatcher, use advanceUntilIdle() |
Skill("kotlin-testing")
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.