Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected RunControllerTest::shouldDeleteRun test case #3

Open
solomonaboyeji opened this issue Apr 22, 2024 · 0 comments
Open

Corrected RunControllerTest::shouldDeleteRun test case #3

solomonaboyeji opened this issue Apr 22, 2024 · 0 comments

Comments

@solomonaboyeji
Copy link

In the RunControllerTest.java, you have a failing test which was meant to mock deleting of run. You omit mocking the repository's findById method as seen below:

    @Test
    void shouldDeleteRun() throws Exception {
        var run = new Run(null, "Test", LocalDateTime.now(), LocalDateTime.now().plusMinutes(1), 1, Location.OUTDOOR,
                null);
        when(repository.findById(ArgumentMatchers.anyInt())).thenReturn(Optional.of(run));
        mvc.perform(delete("/api/runs/1"))
                .andExpect(status().isNoContent());
    }
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

No branches or pull requests

1 participant