Skip to content

test:migrate JUnit 4 + PowerMock to JUnit 5 + Mockito in logger-admin,opentelemetry modules#127

Merged
wardseptember merged 2 commits intotrpc-group:JDK17/Springboot3from
drow931:JDK17/Springboot3
Feb 6, 2026
Merged

test:migrate JUnit 4 + PowerMock to JUnit 5 + Mockito in logger-admin,opentelemetry modules#127
wardseptember merged 2 commits intotrpc-group:JDK17/Springboot3from
drow931:JDK17/Springboot3

Conversation

@drow931
Copy link

@drow931 drow931 commented Feb 5, 2026

migrate tests from JUnit 4 + PowerMock to JUnit 5 + Mockito in logger-admin,opentelemetry

Summary

This PR continues the test framework migration effort, updating test classes
in trpc-logger and trpc-opentelemetry modules.

Changes

Test Migration

  • trpc-logger-admin: Migrate 6 test classes to JUnit 5 + Mockito

    • Log4j2LoggerProcessUnitTest
    • LogbackLoggerProcessUnitTest
    • LoggerLevelInfoTest
    • LoggerManagerTest
    • LoggerProcessUnitFactoryTest
    • UnSupportLoggerProcessUnitTest
  • trpc-opentelemetry: Migrate 2 test classes to JUnit 5 + Mockito

    • OpenTelemetryFactoryTest
    • TrpcFilterTest

Code Improvements

  • Replace @Before/@After with @BeforeEach/@AfterEach
  • Replace Assert.* with Assertions.*
  • Replace PowerMockito.mockStatic with Mockito.mockStatic (try-with-resources)
  • Replace ExpectedException.expect() with assertThrows()
  • Add reflection-based static field reset for singleton test isolation

Refactor comments in LoggerProcessUnitFactoryTest.java as a follow-up
to the JUnit 5 migration work. This ensures all comments follow the
project's English documentation standards.
@wardseptember wardseptember marked this pull request as ready for review February 6, 2026 06:16
@wardseptember wardseptember merged commit dbe0e5e into trpc-group:JDK17/Springboot3 Feb 6, 2026
7 of 8 checks passed
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