content: package io.reflectoring.coderadar.rest.unit.useradministration.teams;
  
  import static org.mockito.Mockito.mock;
  
  import io.reflectoring.coderadar.domain.ProjectRole;
  import io.reflectoring.coderadar.projectadministration.ProjectNotFoundException;
  import io.reflectoring.coderadar.rest.ProjectRoleJsonWrapper;
  import io.reflectoring.coderadar.rest.unit.UnitTestTemplate;
  import io.reflectoring.coderadar.rest.useradministration.teams.AddTeamToProjectController;
  import io.reflectoring.coderadar.useradministration.TeamNotFoundException;
  import io.reflectoring.coderadar.useradministration.port.driver.teams.AddTeamToProjectUseCase;
  import org.junit.jupiter.api.Assertions;
  import org.junit.jupiter.api.Test;
  import org.mockito.Mockito;
  import org.springframework.http.HttpStatus;
  import org.springframework.http.ResponseEntity;
  
  class AddTeamToProjectControllerTest extends UnitTestTemplate {
    private final AddTeamToProjectUseCase addTeamToProjectUseCase =
        mock(AddTeamToProjectUseCase.class);
    private final AddTeamToProjectController testController =
        new AddTeamToProjectController(addTeamToProjectUseCase, authenticationService);
  
    @Test
    void testAddTeamToProject() {
      ResponseEntity<HttpStatus> response =
          testController.addTeamToProject(1L, 2L, new ProjectRoleJsonWrapper(ProjectRole.ADMIN));
      Assertions.assertEquals(HttpStatus.OK, response.getStatusCode());
    }
  
    @Test
    void testRemoveTeamFromProjectThrowsExceptionWhenTeamNotFound() {
      Mockito.doThrow(TeamNotFoundException.class)
          .when(addTeamToProjectUseCase)
          .addTeamToProject(1L, 2L, ProjectRole.ADMIN);
      ProjectRoleJsonWrapper jsonWrapper = new ProjectRoleJsonWrapper(ProjectRole.ADMIN);
  
      Assertions.assertThrows(
          TeamNotFoundException.class, () -> testController.addTeamToProject(1L, 2L, jsonWrapper));
    }
  
    @Test
    void testRemoveTeamFromProjectThrowsExceptionWhenProjectNotFound() {
      Mockito.doThrow(ProjectNotFoundException.class)
          .when(addTeamToProjectUseCase)
          .addTeamToProject(1L, 2L, ProjectRole.ADMIN);
      ProjectRoleJsonWrapper jsonWrapper = new ProjectRoleJsonWrapper(ProjectRole.ADMIN);
  
      Assertions.assertThrows(
          ProjectNotFoundException.class, () -> testController.addTeamToProject(1L, 2L, jsonWrapper));
    }
  }
  