Skip to content

Conversation

@atulgpt
Copy link
Contributor

@atulgpt atulgpt commented Nov 17, 2025

Migrating one TC file to kt so that mockito can be removed
This was mentioned in #1362 (comment)

This will unblock #1247

@atulgpt atulgpt requested a review from a team as a code owner November 17, 2025 20:38
@atulgpt atulgpt force-pushed the chore/migrate-to-kt branch from fffa501 to 43e1e80 Compare November 17, 2025 20:50
@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.56%. Comparing base (438fadc) to head (bac36cc).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1394      +/-   ##
==========================================
+ Coverage   63.16%   63.56%   +0.39%     
==========================================
  Files         158      158              
  Lines        3125     3134       +9     
  Branches      324      326       +2     
==========================================
+ Hits         1974     1992      +18     
+ Misses       1056     1045      -11     
- Partials       95       97       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

activityListenerCaptor.capture(),
ArgumentMatchers.eq(frameMetricsHandler),
)
Assert.assertEquals(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer the assertj style assertions, can you modify this to use assertj please?

Comment on lines 25 to 33
import org.mockito.Answers
import org.mockito.ArgumentCaptor
import org.mockito.ArgumentMatchers
import org.mockito.Captor
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.junit.MockitoJUnit
import org.mockito.junit.MockitoRule
import org.mockito.stubbing.Answer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR and the issue you referenced in the PR description both make mention of our desire to move away from mockito in favor of mockk. Would it be possible for you to do that conversion as part of this PR as well? Thanks!

Comment on lines 66 to 68
Assert.assertEquals(
span.spanContext.traceId,
currentSpan.traceId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was already structured this way, so you're not making it worse or anything, but any time I see assertions inside of callback/async/conditional code I'm leery, because there can be unexpected cases where the callback (in this case an interceptor) doesn't get invoked at all and the test still passes without the assertion being invoked.

If we're going to keep that around, then I think there also needs to be a side effect that we can also assert on to ensure that the assertion was invoked (I've frequently used countdown latches for such a thing).

@atulgpt atulgpt requested a review from breedx-splk November 19, 2025 06:07
currentSpan.traceId,
)
chain!!.proceed(chain.request())
Assertions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the static import for these, because it reads nicer.

Comment on lines 198 to 213
private fun makeSomeDurations(): List<Long> =
Stream
.of(
5L,
11L,
101L, // slow
701L, // frozen
17L, // slow
17L, // slow
16L,
11L,
).map { duration ->
TimeUnit.MILLISECONDS.toNanos(
duration,
)
}.collect(Collectors.toList())
Copy link
Contributor

@breedx-splk breedx-splk Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we're in kotlin, using Stream for this should be unnecessary. You can do something more like

listOf(
    5L, 11L, 101L, // slow
    701L, // frozen
    17L, // slow
    17L, // slow
    16L, 11L)
.map { it.milliseconds.inWholeNanoseconds }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants