Gyeongtae Park created ZEPPELIN-6201:
----------------------------------------
Summary: Add missing unit tests for utils package classes
Key: ZEPPELIN-6201
URL: https://issues.apache.org/jira/browse/ZEPPELIN-6201
Project: Zeppelin
Issue Type: Test
Reporter: Gyeongtae Park
Assignee: Gyeongtae Park
Fix For: 1.0.0, 0.12.1, 0.13.0
Attachments: image-2025-06-14-21-39-09-556.png
h3. Summary
Several utility classes under {{org.apache.zeppelin.utils}} had no dedicated
unit‐test coverage.
This ticket adds a complete JUnit 5/Mockito test suite for the following
classes:
* {{AnyOfRolesUserAuthorizationFilter}}
* {{{}CommandLineUtils{}}}{{{}{}}}
* {{{}ExceptionUtils{}}}{{{}{}}}
* {{ServerUtils}}
h3. Motivation
* Increase overall code reliability and prevent regressions.
* Bring the utils package closer to the project’s desired test‐coverage
thresholds.
* Provide executable examples of expected behaviour for future contributors.
h3. Implementation Notes
* Each test follows the “Given – When – Then” style for clarity.
* External dependencies are mocked with Mockito to keep tests hermetic.
* {{System.out}} is captured via {{ByteArrayOutputStream}} where console
output needs verification ({{{}CommandLineUtils{}}}).
* For Shiro‐based logic ({{{}AnyOfRolesUserAuthorizationFilter{}}}) a stubbed
{{Subject}} is injected via an overridden {{getSubject}} method.
* No production code changes were required; only new test sources were added
under {{{}zeppelin-server/src/test/java/org/apache/zeppelin/utils/{}}}.
h3. How to Verify
# Run ` ./mvnw -pl zeppelin-server
-Dtest=AnyOfRolesUserAuthorizationFilterTest,CommandLineUtilsTest,ExceptionUtilsTest,ServerUtilsTest
test` (or the full Maven build).
# All newly added test classes should pass with 100 % success rate.
# Verify JaCoCo (or your coverage tool) shows an increase in line and branch
coverage for the utils package.
h3. Affected Modules
* *zeppelin-server* – test sources only
h3. Related Work
N/A
h3. Screenshots / Evidence
!image-2025-06-14-21-39-09-556.png|width=295,height=130!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)