### Question:
InMemoryTeams implements Teams { @Override public void addTeam(Team team) { if (this.teams.put(team.getName(), team) != null) { throw new IllegalArgumentException("Team already exists"); } }  @Override Optional<Team> getByName(String name); @Override Set<String> getTeamNames(); @Override Team getMostFreeTeam(); @Override void addTeam(Team team); @Override Set<Team> getAllTeams(); @Override int getAliveTeams();  }### Answer:
@Test(expected = IllegalArgumentException.class) public void whenAttemptToOverwriteExistingTeamThenFailed() { addTeam(1); addTeam(1); }