// Path: spat-services/src/test/java/com/pcalouche/spat/AbstractServiceTest.java
// @ExtendWith(SpringExtension.class)
// @DataJpaTest
// public abstract class AbstractServiceTest {
// }
// 
// Path: spat-services/src/main/java/com/pcalouche/spat/api/dto/TeamDto.java
// @Data
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// public class TeamDto {
//     @EqualsAndHashCode.Exclude
//     private Integer id;
//     private String name;
// 
//     public static TeamDto map(Team team) {
//         return TeamDto.builder()
//                 .id(team.getId())
//                 .name(team.getName())
//                 .build();
//     }
// }
// 
// Path: spat-services/src/main/java/com/pcalouche/spat/api/dto/TeamEditRequest.java
// @Data
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// public class TeamEditRequest {
//     @NotEmpty
//     private String name;
// }
// 
// Path: spat-services/src/main/java/com/pcalouche/spat/entity/Team.java
// @Entity
// @Table(name = "teams")
// @Getter
// @Setter
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// public class Team {
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     private Integer id;
//     @NotBlank
//     @Column(unique = true, nullable = false)
//     private String name;
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) {
//             return true;
//         }
//         if (!(o instanceof Team)) {
//             return false;
//         }
//         Team castedObj = (Team) o;
//         return Objects.equals(name, castedObj.getName());
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(name);
//     }
// }
// 
// Path: spat-services/src/main/java/com/pcalouche/spat/repository/TeamRepository.java
// @Repository
// public interface TeamRepository extends JpaRepository<Team, Integer> {
//     Optional<Team> findByName(String name);
// }


import com.pcalouche.spat.AbstractServiceTest;
import com.pcalouche.spat.api.dto.TeamDto;
import com.pcalouche.spat.api.dto.TeamEditRequest;
import com.pcalouche.spat.entity.Team;
import com.pcalouche.spat.repository.TeamRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat;
package com.pcalouche.spat.service;




public class TeamServiceTest extends AbstractServiceTest {
    @Autowired
    private TeamRepository teamRepository;
    private TeamService teamService;
    private Team team1;
    private Team team2;

    @BeforeEach
    public void before() {
// Path: spat-services/src/test/java/com/pcalouche/spat/AbstractServiceTest.java
// @ExtendWith(SpringExtension.class)
// @DataJpaTest
// public abstract class AbstractServiceTest {
// }
// 
// Path: spat-services/src/main/java/com/pcalouche/spat/api/dto/TeamDto.java
// @Data
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// public class TeamDto {
//     @EqualsAndHashCode.Exclude
//     private Integer id;
//     private String name;
// 
//     public static TeamDto map(Team team) {
//         return TeamDto.builder()
//                 .id(team.getId())
//                 .name(team.getName())
//                 .build();
//     }
// }
// 
// Path: spat-services/src/main/java/com/pcalouche/spat/api/dto/TeamEditRequest.java
// @Data
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// public class TeamEditRequest {
//     @NotEmpty
//     private String name;
// }
// 
// Path: spat-services/src/main/java/com/pcalouche/spat/entity/Team.java
// @Entity
// @Table(name = "teams")
// @Getter
// @Setter
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// public class Team {
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     private Integer id;
//     @NotBlank
//     @Column(unique = true, nullable = false)
//     private String name;
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) {
//             return true;
//         }
//         if (!(o instanceof Team)) {
//             return false;
//         }
//         Team castedObj = (Team) o;
//         return Objects.equals(name, castedObj.getName());
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(name);
//     }
// }
// 
// Path: spat-services/src/main/java/com/pcalouche/spat/repository/TeamRepository.java
// @Repository
// public interface TeamRepository extends JpaRepository<Team, Integer> {
//     Optional<Team> findByName(String name);
// }


// Path: spat-services/src/test/java/com/pcalouche/spat/service/TeamServiceTest.java
import com.pcalouche.spat.AbstractServiceTest;
import com.pcalouche.spat.api.dto.TeamDto;
import com.pcalouche.spat.api.dto.TeamEditRequest;
import com.pcalouche.spat.entity.Team;
import com.pcalouche.spat.repository.TeamRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat;

package com.pcalouche.spat.service;




public class TeamServiceTest extends AbstractServiceTest {
    @Autowired
    private TeamRepository teamRepository;
    private TeamService teamService;
    private Team team1;
    private Team team2;

    @BeforeEach
    public void before() {
        teamService = new TeamServiceImpl(teamRepository);