Skip to content

Instantly share code, notes, and snippets.

@FranckSilvestre
Created March 14, 2024 15:16
Show Gist options
  • Save FranckSilvestre/e5fbd26e33755f595c27440cdce0719a to your computer and use it in GitHub Desktop.
Save FranckSilvestre/e5fbd26e33755f595c27440cdce0719a to your computer and use it in GitHub Desktop.
v1 on OurBusinessProject 2023-2024
package ourbusinessproject;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import static org.mockito.Mockito.verify;
@ExtendWith(MockitoExtension.class)
class ProjectControllerTest {
@Mock
private EnterpriseProjectService enterpriseProjectService;
private ProjectController projectController;
@BeforeEach
public void setUp() {
projectController = new ProjectController(enterpriseProjectService);
}
@Test
public void testControllerDelegationToService() {
// when requesting for all projects
projectController.findAllProjectsWithEnterprises();
// then the request is performed by the enterprise project service
verify(enterpriseProjectService).findAllProjects();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment