Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
23 views

ParameterizedTest JUNIT5 with suspend functions

I'm trying to clean a little bit my code and when testing my datasource I'm repeating a lot the test that returns connection and service error, and I'd like to have a bunch of code that tests ...
StuartDTO's user avatar
  • 891
1 vote
1 answer
81 views

Use custom Dockerfile with JUnit testcontainers for OpenSearch

I'm trying to use a JUnit test container for OpenSearch, in Kotlin, with the Spring Boot framework. (Enough qualifiers?) I've been able to get it mostly working, roughly like this: class ...
Crell's user avatar
  • 524
1 vote
2 answers
124 views

Testing Dispatcher IO and ViewModelScope in Unit Tests

I'm trying to test some code in my viewmodel. I'm trying to make two network calls with dispatcher async, but haven't figured out how to test. This is a simplified example of what I'm essentially ...
keyboard_user's user avatar
0 votes
0 answers
22 views

Unit testing class with flow collection in init

How can I best go about unit testing flows that are collected in a class's init function? The only solution I've come up with so far requires hard-coded delays. Consider a sample implementation of a ...
Henrik Klev's user avatar
2 votes
1 answer
88 views

Cannot run explicitly tagged test only in Kotest

I have a spring boot project which uses kotlin version 1.7.0. My pom looks something like below. <properties> <kotlin.version>1.7.0</kotlin.version> ... </<...
Risalat Zaman's user avatar
0 votes
0 answers
127 views

Kotlin Coroutines Test: UncompletedCoroutinesError - Test Coroutine Not Completing

I'm encountering an UncompletedCoroutinesError while running a Kotlin coroutine test. The specific error message is: kotlinx.coroutines.test.UncompletedCoroutinesError: After waiting for 1m, the test ...
Kotiswar Kaithepalli's user avatar
0 votes
2 answers
50 views

Why doesn't my unit test for kotlin flow fail?

I would have expected this test to fail: @Test fun testFlowFailure() = runTest { val flow = MutableStateFlow(0) val latch = CountDownLatch(1) val job = launch { flow.collect { ...
Robert's user avatar
  • 6,953
0 votes
1 answer
19 views

how can i take access to test method like AbstractClass.InnerClass.fun

I'm trying to write unit test for Abstract Class Realization and I need to write test for method with path Class.InnerClass.fun. example InClass.b2: package com.example.kotlin_spring abstract class ...
Zzz Zzz's user avatar
1 vote
0 answers
85 views

AspectJ Internal Error: unable to add stackmap attributes. Unsupported class file major version 61

I have the following Kotlin application ------------------------------------------------------------ Gradle 8.7 ------------------------------------------------------------ Kotlin: 1.9.22 ...
RobertNickel's user avatar
0 votes
1 answer
32 views

JUnit Testing Multiple Values Against Same Function Best Practice

Say I have various input strings that are passed into the same function and returns output strings that are compared against their expected results. For example, periods should be transformed to ...
BobDidley's user avatar
  • 123
1 vote
0 answers
40 views

Android Mockito and JUnit Firebase Auth testing

I'm trying to implement a test in Android using Mockito and JUnit, to Firebase register method (that I did using Dependecy Injection with Hilt) I received a lot of different erros, and I don't know ...
Mateus Camillo's user avatar
0 votes
0 answers
26 views

How I can test location service, and it's permissions with junit?

Is it possible to write to write instrumental tests and later on for location permissions? I'm relatively new to testing topic, and I haven't found much examples that could possibly help me with it.
SmierdzoncaRobotaEhhh's user avatar
0 votes
0 answers
39 views

How to mock a static method that modifies an input and returns Unit with Mockk

I'm trying to use Mockk to mock the static method android.location.Location.distanceBetween(). Here's my test case: class DistanceUtilsTest { @Before fun setup() { MockKAnnotations....
toshiomagic's user avatar
  • 1,527
0 votes
0 answers
18 views

pom.xml file for kotlin Junit fails with "ClassSelector [className = 'InventoryTest'] resolution failed"

I am trying to set up some kotlin tests with JUnit, but when trying to run the tests, i get the following error: Internal Error occurred. org.junit.platform.commons.JUnitException: TestEngine with ID '...
powerofcode's user avatar
0 votes
1 answer
152 views

Why am I getting a No interface method complete in class CompletableJob Exception

I'm getting this error when running a unit test on a composable: No interface method complete()Z in class Lkotlinx/coroutines/CompletableJob; or its super classes (declaration of 'kotlinx.coroutines....
coder's user avatar
  • 6,115

15 30 50 per page
1
2 3 4 5
36