Skip to content

Improve 131-java-unit-testing.md avoiding Unit Tests based on Reflection. #384

@jabrena

Description

@jabrena

Example

        @Test
        @DisplayName("Should identify terminal status COMPLETED")
        void should_identifyTerminalStatus_when_completed() throws Exception {
            // Given
            CursorAgent agent = new CursorAgent(TEST_API_KEY, TEST_BASE_URL);
            Method method = CursorAgent.class.getDeclaredMethod("isTerminalStatus", Agent.StatusEnum.class);
            method.setAccessible(true);

            // When
            Boolean result = (Boolean) method.invoke(agent, Agent.StatusEnum.COMPLETED);

            // Then
            assertThat(result).isTrue();
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions