Commits

trikitrok  committed 8c2b3c6 Draft

Practica Esturctura Informacion Semestre 1 2011-2012

  • Participants

Comments (0)

Files changed (31)

File src/testsForPractica/AllTests.java

+package testsForPractica;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ testRating.class, testZooManagerImpl.class, testSpecies.class, 
+			    testRiskLevel.class, testVeterinayAttention.class, 
+			    testVisitors.class, testAnimal.class, testBestVisitorsQueue.class})
+public class AllTests {
+
+}

File src/testsForPractica/TestHelpers/AnimalComparatorByName.java

+package testsForPractica.TestHelpers;
+
+import java.util.Comparator;
+
+import uoc.ei.practica.Animal;
+
+public class AnimalComparatorByName implements Comparator<Animal> {
+	   
+    public int compare(Animal animal1, Animal animal2) {
+   
+        String name1 = animal1.getName();        
+        String name2 = animal2.getName();
+       
+        return name1.compareTo(name2);
+    }
+}

File src/testsForPractica/TestHelpers/SpeciesComparatorById.java

+package testsForPractica.TestHelpers;
+
+import java.util.Comparator;
+
+import uoc.ei.practica.Species;
+
+public class SpeciesComparatorById implements Comparator<Species> {
+	 public int compare(Species species1, Species species2) {
+	
+	     String id1 = species1.getId();        
+	     String id2 = species2.getId();
+	    
+	     return id1.compareTo(id2);
+	 }
+}

File src/testsForPractica/testAnimal.java

+package testsForPractica;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import uoc.ei.practica.Animal;
+import uoc.ei.practica.Rating;
+import uoc.ei.practica.RiskLevel;
+import uoc.ei.practica.Species;
+
+public class testAnimal {
+
+	private final String LS = System.getProperty("line.separator");
+	
+	Animal animal;
+	
+	@Before
+	public void setUp() {
+		Rating rating = new Rating("MAMMAL", "xxx");
+		RiskLevel riskLevel = new RiskLevel(0, "LEAST CONCERN"); 
+		Species species = new Species("CATALAN DONKEY", "yyy", "zzz", "444", rating, riskLevel);
+		animal = new Animal(rating, species, "lola", 20);
+	}
+	
+	@Test
+	public void testCreation() {
+	}
+	
+	@Test
+	public void testToString() {
+		assertEquals("name:lola" + LS + "age: 20" + LS + "rating: MAMMAL" + LS + "speciesId: CATALAN DONKEY" + LS,
+					animal.toString());
+	}
+}

File src/testsForPractica/testBestVisitorsQueue.java

+package testsForPractica;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import uoc.ei.practica.Animal;
+import uoc.ei.practica.BestOnes;
+import uoc.ei.practica.Rating;
+import uoc.ei.practica.RiskLevel;
+import uoc.ei.practica.Species;
+import uoc.ei.practica.Visitor;
+import uoc.ei.practica.VisitorComparatorByVisits;
+import uoc.ei.tads.Iterador;
+
+public class testBestVisitorsQueue {
+
+	BestOnes<Visitor> bestOnes;
+	
+	@Before
+	public void setUp () {
+		bestOnes = new BestOnes<Visitor>(3, new VisitorComparatorByVisits());
+	}
+	
+	@Test
+	public void testCreation() {
+	}
+	
+	@Test
+	public void testAddVisitorToQueue() {
+		Visitor visitor1 = new Visitor("1234", "Gabi");
+		bestOnes.addElement(visitor1);
+	}
+
+	@Test
+	public void testGetBestOnesWithoutVisits() {
+		Visitor visitor1 = new Visitor("1234", "Gabi");
+		Visitor visitor2 = new Visitor("2345", "Meri");
+		Visitor visitor3 = new Visitor("3456", "Vane");
+		
+		bestOnes.addElement(visitor1);
+		Iterador<Visitor> visitors = bestOnes.getBestOnes();
+		assertEquals("Gabi", visitors.seguent().getName());
+		
+		bestOnes.addElement(visitor1);
+		bestOnes.addElement(visitor2);
+		visitors = bestOnes.getBestOnes();
+		assertEquals("Gabi", visitors.seguent().getName());
+		assertEquals("Meri", visitors.seguent().getName());
+		
+		bestOnes.addElement(visitor1);
+		bestOnes.addElement(visitor2);
+		bestOnes.addElement(visitor3);
+		visitors = bestOnes.getBestOnes();
+		assertEquals("Gabi", visitors.seguent().getName());
+		assertEquals("Meri", visitors.seguent().getName());
+		assertEquals("Vane", visitors.seguent().getName());
+	}
+	
+
+	@Test
+	public void testGetBestOnesWithVisits() {
+		Rating rating = new Rating("MAMMAL", "xxx");
+		RiskLevel riskLevel = new RiskLevel(0, "LEAST CONCERN"); 
+		Species species = new Species("CATALAN DONKEY", "yyy", "zzz", "444", rating, riskLevel);
+		Animal animal1 = new Animal(rating, species, "kela", 10);
+		Animal animal2 = new Animal(rating, species, "pepa", 10);
+		Animal animal3 = new Animal(rating, species, "lela", 10);
+		Animal animal4 = new Animal(rating, species, "fela", 10);
+		Animal animal5 = new Animal(rating, species, "fefa", 10);
+		Visitor visitor1 = new Visitor("1234", "Gabi");
+		Visitor visitor2 = new Visitor("2345", "Meri");
+		Visitor visitor3 = new Visitor("3456", "Vane");
+		Visitor visitor4 = new Visitor("4567", "Mano");	
+		
+		bestOnes.addElement(visitor1);
+		bestOnes.addElement(visitor2);
+		bestOnes.addElement(visitor3);
+		Iterador<Visitor> visitors = bestOnes.getBestOnes();
+		assertEquals("Gabi", visitors.seguent().getName());
+		assertEquals("Meri", visitors.seguent().getName());
+		assertEquals("Vane", visitors.seguent().getName());
+		
+		visitor1.addVisitedAnimal(animal2);
+		bestOnes.addElement(visitor1);
+		visitor1.addVisitedAnimal(animal3); 
+		bestOnes.addElement(visitor1);
+		
+		visitor2.addVisitedAnimal(animal2);
+		bestOnes.addElement(visitor2);
+		visitor2.addVisitedAnimal(animal3);
+		bestOnes.addElement(visitor2);
+		visitor2.addVisitedAnimal(animal4);
+		bestOnes.addElement(visitor2);
+		visitor2.addVisitedAnimal(animal5);
+		bestOnes.addElement(visitor2);
+		
+		visitor3.addVisitedAnimal(animal2);
+		bestOnes.addElement(visitor3);
+		visitor3.addVisitedAnimal(animal3);
+		bestOnes.addElement(visitor3); 
+		visitor3.addVisitedAnimal(animal4);
+		bestOnes.addElement(visitor3);
+		
+		visitors = bestOnes.getBestOnes();
+		assertEquals("Meri", visitors.seguent().getName());
+		assertEquals("Vane", visitors.seguent().getName());
+		assertEquals("Gabi", visitors.seguent().getName());
+		
+		visitor4.addVisitedAnimal(animal1); 
+		visitor4.addVisitedAnimal(animal2);
+		visitor4.addVisitedAnimal(animal3);
+		visitor4.addVisitedAnimal(animal4); 
+		visitor4.addVisitedAnimal(animal5); 
+		
+		bestOnes.addElement(visitor4);
+		
+		visitors = bestOnes.getBestOnes();
+		assertEquals("Mano", visitors.seguent().getName());
+		assertEquals("Meri", visitors.seguent().getName());
+		assertEquals("Vane", visitors.seguent().getName());
+		
+		visitor1.addVisitedAnimal(animal4);
+		bestOnes.addElement(visitor1);
+
+		visitors = bestOnes.getBestOnes();
+		assertEquals("Mano", visitors.seguent().getName());
+		assertEquals("Meri", visitors.seguent().getName());
+		assertEquals("Vane", visitors.seguent().getName());
+		
+		visitor1.addVisitedAnimal(animal4);
+		visitor1.addVisitedAnimal(animal4);
+		visitor1.addVisitedAnimal(animal4);
+		visitor1.addVisitedAnimal(animal4);
+		visitor1.addVisitedAnimal(animal4);
+		visitor1.addVisitedAnimal(animal4);
+		visitor1.addVisitedAnimal(animal4);
+		visitor1.addVisitedAnimal(animal4);
+		visitor1.addVisitedAnimal(animal4);
+		bestOnes.addElement(visitor1);
+
+//		System.out.println(visitor1.getName() + " " +visitor1.getVisits());
+//		System.out.println(visitor2.getName() + " " +visitor2.getVisits());
+//		System.out.println(visitor3.getName() + " " +visitor3.getVisits());
+//		System.out.println(visitor4.getName() + " " +visitor4.getVisits());
+//		System.out.println("");
+		
+		visitors = bestOnes.getBestOnes();
+		assertEquals("Gabi", visitors.seguent().getName());
+		assertEquals("Mano", visitors.seguent().getName());
+		assertEquals("Meri", visitors.seguent().getName());
+		
+		visitor3.addVisitedAnimal(animal2);
+		visitor3.addVisitedAnimal(animal3);
+		visitor3.addVisitedAnimal(animal4);
+		visitor3.addVisitedAnimal(animal2);
+		visitor3.addVisitedAnimal(animal3);
+		visitor3.addVisitedAnimal(animal4);
+		bestOnes.addElement(visitor3);
+		visitors = bestOnes.getBestOnes();
+		
+//		System.out.println(visitor1.getName() + " " +visitor1.getVisits());
+//		System.out.println(visitor2.getName() + " " +visitor2.getVisits());
+//		System.out.println(visitor3.getName() + " " +visitor3.getVisits());
+//		System.out.println(visitor4.getName() + " " +visitor4.getVisits());
+		
+		visitors = bestOnes.getBestOnes();
+		assertEquals("Gabi", visitors.seguent().getName());
+		assertEquals("Vane", visitors.seguent().getName());
+		assertEquals("Mano", visitors.seguent().getName());
+	}
+	
+}

File src/testsForPractica/testRating.java

+package testsForPractica;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import uoc.ei.practica.Animal;
+import uoc.ei.practica.EIException;
+import uoc.ei.practica.Messages;
+import uoc.ei.practica.Rating;
+import uoc.ei.practica.RiskLevel;
+import uoc.ei.practica.Species;
+
+public class testRating {
+
+	private final String LS = System.getProperty("line.separator");
+	private RiskLevel riskLevel;
+	private Rating rating;
+	
+	@Before
+	public void setUp() {
+		rating = new Rating("MAMMAL", "description for mammal");
+		riskLevel = new RiskLevel(0, "riskName");
+	}
+	
+	@Test
+	public void testRatingCreation() {
+	}
+
+	@Test
+	public void testEquals() {
+		Rating rating2 = new Rating("MAMMAL", "description for mammal");
+		Rating rating3 = new Rating("other_id_rating", "other_desc_rating");
+		
+		assertEquals(rating.equals(rating2), true);
+		assertEquals(rating.equals(rating3), false);
+	}
+	
+	@Test
+	public void testToString() {
+		assertEquals("id: MAMMAL" + LS + "description for mammal" + LS, rating.toString());
+	}
+
+	@Test
+	public void testAddSpecies() {
+		Species species = new Species("speciesId", "habitat", "areaOfOrigin", "reproduction", rating, riskLevel);
+		rating.addSpecies(species);
+	}
+
+	@Test
+	public void testGetSpeciesWhenSpeciesExists() throws EIException {
+		Species species = new Species("speciesId", "habitat", "areaOfOrigin", "reproduction", rating, riskLevel);
+		rating.addSpecies(species);
+		
+		Species species2 = rating.getSpecies("speciesId");
+		
+		assertEquals("speciesId", species2.getId());
+	}
+	
+	@Test
+	public void testThatGetSpeciesRaisesAnExceptionIfSpeciesDoesNotExist() {
+		try {
+			rating.getSpecies("speciesId");
+			fail("No exception caught :(");
+		} catch (EIException e) {
+			assertEquals(Messages.SPECIES_NOT_EXIST, e.getMessage());
+		}
+	}
+
+	@Test
+	public void testThatGettingListOfSpeciesRaisesAnExceptionIfThereAreNoSpeciesYet() {
+		try {
+			rating.species();
+			fail("No exception caught :(");
+		} catch (EIException e) {
+			assertEquals(Messages.NO_SPECIES, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testAddGetAnimal() throws EIException {
+		Species species = new Species("gato", "HOME", "BCN", "WHEN_IT_CAN", rating, riskLevel);
+		rating.addSpecies(species);
+		
+		rating.addAnimal("gato", "pipo", 2);
+		Animal animal = rating.getAnimal("gato", "pipo");
+		
+		assertEquals("pipo", animal.getName());
+		assertEquals(2, animal.getAge());
+		assertEquals("MAMMAL", animal.getRatingId());
+	}
+
+	@Test
+	public void testThatAddAnimalRaisesAnExceptionIfTheSpeciesIsNotFound(){
+		Species species = new Species("cerdo", "HOME", "BCN", "WHEN_IT_CAN", rating, riskLevel);
+		rating.addSpecies(species);
+		try {
+			rating.addAnimal("pulpo", "bob", 2);
+			fail("No exception caught :(");
+		} catch (EIException e) {
+			assertEquals(Messages.SPECIES_NOT_EXIST, e.getMessage());
+		}
+	}
+}

File src/testsForPractica/testRiskLevel.java

+package testsForPractica;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import uoc.ei.practica.RiskLevel;
+
+public class testRiskLevel {
+
+	RiskLevel riskLevel;
+	
+	@Before
+	public void setUp() {
+		riskLevel = new RiskLevel(0, "LEAST CONCERN");
+	}
+	
+	@Test
+	public void testRiskLevelCreation() {	
+	}
+	
+	@Test
+	public void testGetters() {
+		assertEquals(0, riskLevel.getId());
+		assertEquals("LEAST CONCERN", riskLevel.getName());
+	}
+
+	@Test
+	public void testToString() {
+		assertEquals("LEAST CONCERN", riskLevel.toString());
+	}
+}

File src/testsForPractica/testRiskLevels.java

+package testsForPractica;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import uoc.ei.practica.EIException;
+import uoc.ei.practica.Messages;
+import uoc.ei.practica.RiskLevels;
+
+public class testRiskLevels {
+
+	RiskLevels riskLevelsList;
+	
+	@Before
+	public void setUp() {
+		riskLevelsList = new RiskLevels();
+	}
+	
+	@Test
+	public void testCreation() {
+	}
+
+	@Test
+	public void testAddRiskLevel() throws EIException {
+		riskLevelsList.addRiskLevel(0, "LEAST CONCERN");
+		riskLevelsList.addRiskLevel(1, "VULNERABLE");
+		riskLevelsList.addRiskLevel(2, "CRITICALLY ENDARGERED");
+		riskLevelsList.addRiskLevel(3, "EXTINCT");
+		assertEquals("LEAST CONCERN", riskLevelsList.getRiskLevel(0).getName());
+		assertEquals("VULNERABLE", riskLevelsList.getRiskLevel(1).getName());
+		assertEquals("CRITICALLY ENDARGERED", riskLevelsList.getRiskLevel(2).getName());
+		assertEquals("EXTINCT", riskLevelsList.getRiskLevel(3).getName());
+	}
+	
+	@Test
+	public void testThatAddRiskLevelThrowsAnExceptionWhenTheRiskLevelAlreadyExists() {
+		try {
+			riskLevelsList.addRiskLevel(0, "LEAST CONCERN");
+			riskLevelsList.addRiskLevel(0, "LEAST CONCERN");
+		}  catch (EIException e) {
+			assertEquals(Messages.RISK_LEVEL_ALREADY_EXISTS, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testThatAddRiskLevelThrowsAnExceptionWhenTheRiskLevelNameIsUnknown() {
+		try {
+			riskLevelsList.addRiskLevel(0, "xxx");
+		}  catch (EIException e) {
+			assertEquals(Messages.UNKNOWN_RISK_LEVEL, e.getMessage());
+		}
+	}
+
+}

File src/testsForPractica/testSpecies.java

+package testsForPractica;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import uoc.ei.practica.Animal;
+import uoc.ei.practica.EIException;
+import uoc.ei.practica.Rating;
+import uoc.ei.practica.RiskLevel;
+import uoc.ei.practica.Species;
+
+public class testSpecies {
+
+	private Species species;
+	
+	private final String LS = System.getProperty("line.separator");
+	
+	@Before
+	public void setUp() {
+		Rating rating = new Rating("MAMMAL", "xxx");
+		RiskLevel riskLevel = new RiskLevel(0, "LEAST CONCERN");
+		species = new Species("GIRAFFE", "Savanna", "Africa", "Viviparous", rating, riskLevel);
+	}
+	
+	@Test
+	public void testCreation() {
+	}
+	
+	@Test
+	public void testToString() {
+		assertEquals("speciesId: GIRAFFE" + LS + "rating: MAMMAL" + LS + 
+					"habitat: Savanna" + LS + "areaOfOrigin: Africa" + LS + 
+					"reproduction: Viviparous"+ LS +
+					"visits: 0" + LS + "risk level: LEAST CONCERN" + LS, 
+					species.toString() );
+		
+		Rating rating2 = new Rating("lll", "xxx");
+		RiskLevel riskLevel = new RiskLevel(0,"kkk");
+		Species species2 = new Species("lll", "lll", "lll", "lll", rating2, riskLevel);
+		assertEquals("speciesId: lll" + LS + "rating: lll" + LS + 
+				"habitat: lll" + LS + "areaOfOrigin: lll" + LS + 
+				"reproduction: lll" + LS +
+				"visits: 0" + LS + "risk level: kkk" + LS, 
+				species2.toString());
+	}
+	
+	@Test
+	public void testAddGetAnimal() throws EIException {
+		Animal animal1 = new Animal(species.getRating(), species, "name", 3);
+		species.addAnimal(animal1);
+		
+		Animal animal2 = species.getAnimal("name");
+		
+		assertEquals("name", animal2.getName());
+		assertEquals(3, animal2.getAge());
+		assertEquals(animal1, animal2);
+	}
+	
+	@Test
+	public void testThatAddAnimalChangesAnimalDataWhenAnimalAlreadyExists() throws EIException {
+		Animal animal1 = new Animal(species.getRating(), species, "name", 10);
+		Animal animal2 = new Animal(species.getRating(), species, "name", 3);
+		species.addAnimal(animal1);
+		
+		Animal animal = species.getAnimal("name");
+		
+		assertEquals(10, animal.getAge());
+		
+		species.addAnimal(animal2);
+		
+		animal = species.getAnimal("name");
+		
+		assertEquals(3, animal.getAge());
+	}
+	
+	@Test
+	public void testIncrementVisits() throws EIException {
+		species.incrementVisits();
+		assertEquals(1, species.getVisits());
+		species.incrementVisits();
+		assertEquals(2, species.getVisits());
+		species.incrementVisits();
+		assertEquals(3, species.getVisits());
+	}
+}

File src/testsForPractica/testVeterinayAttention.java

+package testsForPractica;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import uoc.ei.practica.Animal;
+import uoc.ei.practica.Rating;
+import uoc.ei.practica.RiskLevel;
+import uoc.ei.practica.Species;
+import uoc.ei.practica.VeterinaryAttention;
+
+import static org.junit.Assert.assertEquals;
+
+public class testVeterinayAttention {
+
+	private final String LS = System.getProperty("line.separator");
+	
+	Rating rating;
+	RiskLevel riskLevel;
+	Species species;
+	
+	@Before
+	public void setUp(){
+		rating = new Rating("MAMMAL", "xxx");
+		riskLevel = new RiskLevel(0, "LEAST CONCERN"); 
+		species = new Species("CATALAN DONKEY", "yyy", "zzz", "444", rating, riskLevel);
+	}
+	
+	@Test
+	public void testCreation() {
+		Animal animal = new Animal(rating, species, "name", 10);
+		new VeterinaryAttention(animal, 1);
+	}
+	
+	@Test
+	public void testToString() {
+		Rating rating1 = new Rating("FISH", "xxx");
+		RiskLevel riskLevel1 = new RiskLevel(2, "CRITICALLY ENDARGERED"); 
+		Species species = new Species("trucha", "yyy", "zzz", "444", rating, riskLevel1);
+
+		Animal animal = new Animal(rating1, species, "trucha", 43);
+		VeterinaryAttention veterinaryAttention = new VeterinaryAttention(animal, 3);
+		
+		assertEquals("severity: 3" + LS + 
+					  "animal: trucha" + LS +
+					  "risk level: 2" + LS +
+					  "age: 43" + LS, 
+					  veterinaryAttention.toString());		
+	}
+}

File src/testsForPractica/testVisitors.java

+package testsForPractica;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import uoc.ei.practica.Animal;
+import uoc.ei.practica.Rating;
+import uoc.ei.practica.RiskLevel;
+import uoc.ei.practica.Species;
+import uoc.ei.practica.Visitor;
+import uoc.ei.tads.Iterador;
+
+public class testVisitors {
+
+	private final String LS = System.getProperty("line.separator");
+
+	Rating rating;
+	RiskLevel riskLevel;
+	Species species;
+	
+	@Before
+	public void setUp(){
+		rating = new Rating("MAMMAL", "xxx");
+		riskLevel = new RiskLevel(0, "LEAST CONCERN"); 
+		species = new Species("CATALAN DONKEY", "yyy", "zzz", "444", rating, riskLevel);
+	}
+	
+	@Test
+	public void testToString() {
+		Visitor visitor = new Visitor("34", "pau");
+		
+		assertEquals("nif: 34" + LS +
+					"name: pau" + LS +
+					"visits: 0" + LS, visitor.toString());
+	}
+	
+	@Test
+	public void testAddVisitedAnimal() {
+		Visitor visitor = new Visitor("34", "pau");
+		Animal animal = new Animal(rating, species, "name", 10);
+		visitor.addVisitedAnimal(animal);
+		
+		assertEquals(1, visitor.getVisits());
+	}
+	
+	@Test
+	public void testGetVisitedAnimals() {
+		Visitor visitor = new Visitor("34", "pau");
+		Animal animal = new Animal(rating, species, "moko", 10);
+		Animal animal2 = new Animal(rating, species, "miko", 10);
+		visitor.addVisitedAnimal(animal);
+		visitor.addVisitedAnimal(animal2);
+		
+		Iterador<Animal> iterAnimals = visitor.getVisitedAnimals();
+		
+		assertEquals("miko", iterAnimals.seguent().getName());
+		assertEquals("moko", iterAnimals.seguent().getName());
+	}
+}

File src/testsForPractica/testZooManagerImpl.java

+package testsForPractica;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import testsForPractica.TestHelpers.AnimalComparatorByName;
+import testsForPractica.TestHelpers.SpeciesComparatorById;
+import uoc.ei.practica.Animal;
+import uoc.ei.practica.EIException;
+import uoc.ei.practica.Messages;
+import uoc.ei.practica.Rating;
+import uoc.ei.practica.RiskLevel;
+import uoc.ei.practica.Species;
+import uoc.ei.practica.VeterinaryAttention;
+import uoc.ei.practica.Visitor;
+import uoc.ei.practica.ZooManagerImpl;
+import uoc.ei.tads.Iterador;
+
+public class testZooManagerImpl {
+
+	ZooManagerImpl manager;
+
+	private final String LS = System.getProperty("line.separator");
+	
+	@Before
+	public void setUp() {
+		manager = new ZooManagerImpl();
+	}
+	
+	@Test
+	public void testBuildingZooManagerImpl() {
+	}
+
+	@Test
+	public void testThatGetRatingRaisesAnExceptionWhenTheRatingDoesNotExist() {
+		try {
+			manager.getRating("id");
+		} catch (EIException e) {
+			assertEquals(Messages.RATING_NOT_EXIST, e.getMessage());
+		}		
+	}
+	
+	@Test
+	public void testGetRatingWhenTheRatingDoesExist() throws EIException {
+		manager.addRating("ratingId", "description");
+		Rating rating = manager.getRating("ratingId");
+		Rating rating2 = new Rating("ratingId", "description");
+
+		assertEquals(true, rating.equals(rating2));
+	}
+
+	@Test
+	public void testAddingNonExistingRating() throws EIException {		
+		manager.addRating("ratingId", "ratingDescription");		
+		Rating ratingInList = manager.getRating("ratingId");
+		
+		assertEquals("ratingDescription", ratingInList.getDescription());
+	}
+
+	@Test
+	public void testThatWhenAddingAnExistingRatingItModifiesItsDescription() throws EIException {		
+		manager.addRating("ratingId", "ratingDescription");		
+		manager.addRating("ratingId", "ratingNewDescription");
+		Rating ratingInList = manager.getRating("ratingId");
+		
+		assertEquals("ratingNewDescription", ratingInList.getDescription());
+	}
+
+	@Test
+	public void testThatRatingsRaisesAnExceptionIfRatingsListIsEmpty(){		
+		try {
+			manager.ratings();
+			fail("No exception caught :(");
+		} catch (EIException e){
+			assertEquals(Messages.NO_RATINGS, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testRatingsWhenListIsNotEmpty() throws EIException{		
+		manager.addRating("MAMMAL", "description for mammal");
+		manager.addRating("REPTILE", "description for reptile");
+		manager.addRating("BIRD", "description for bird");
+		manager.addRating("MOLLUSK", "description for bird");
+		manager.addRating("FISH", "description for fish");
+				
+		Iterador<Rating> ratings = manager.ratings();
+		
+		StringBuffer sb=new StringBuffer();
+		while(ratings.hiHaSeguent()){
+			sb.append(ratings.seguent().toString());
+			sb.append(LS);
+		}		
+		assertEquals("id: MAMMAL" + LS + "description for mammal" + LS + LS
+				+ "id: REPTILE" + LS + "description for reptile" + LS + LS
+				+ "id: BIRD" + LS + "description for bird" + LS + LS
+				+ "id: MOLLUSK" + LS + "description for bird" + LS + LS
+				+ "id: FISH" + LS + "description for fish" + LS + LS, 
+				sb.toString());
+	}
+	
+	@Test
+	public void testThatWhenAddingASpeciesAExceptionIsRaisedIfTheRatingDoesNotExist() {
+		try {
+			manager.addRiskLevel(0, "LEAST CONCERN");
+			manager.addSpecies("ratingId", "speciesId", "habitat", "areaOfOrigin", "reproduction", 0);
+			fail("No exception caught :(");
+		} catch (EIException e) {
+			assertEquals(Messages.RATING_NOT_EXIST, e.getMessage());	
+		}
+	}
+	
+	@Test
+	public void testThatAddingSpeciesDoesNotRaiseAnyExceptionWhenRatingDoesExist() throws EIException {
+		manager.addRating("ratingId", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("ratingId", "speciesId", "habitat", "areaOfOrigin", "reproduction", 0);
+	}
+	
+	@Test
+	public void testAddAndGetSpecies() throws EIException {
+		manager.addRating("ratingId", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("ratingId", "speciesId", "habitat", "areaOfOrigin", "reproduction", 0);
+		
+		Species species = manager.getSpecies("ratingId", "speciesId");
+		
+		assertEquals("speciesId", species.getId());
+	}
+
+	@Test
+	public void testThatAddingSpeciesThatAlreadyExistsChangesItsData() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "MANOLO", "habitat", "areaOfOrigin", "reproduction", 0);
+		manager.addSpecies("MAMMAL", "MANOLO", "BCN", "CATALUÑA", "OVIPARO", 0);
+		
+		Species species = manager.getSpecies("MAMMAL", "MANOLO");
+		
+		assertEquals("BCN", species.getHabitat());
+		assertEquals("CATALUÑA", species.getAreaOfOrigin());
+		assertEquals("OVIPARO", species.getReproduction());
+	}
+	
+	@Test
+	public void testThatSpeciesRaisesAnExceptionWhenTheClassificationDoesNotExist() {
+		try {
+			manager.species("MAMMAL");
+			fail("No exception caught :(");
+		}
+		catch (EIException e) {
+			assertEquals(Messages.RATING_NOT_EXIST, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testThatSpeciesRaisesAnExceptionWhenThereAreNoSpecies() {
+		manager.addRating("MAMMAL", "description");
+		try {
+			manager.species("MAMMAL");
+			fail("No exception caught :(");
+		}
+		catch (EIException e) {
+			assertEquals(Messages.NO_SPECIES, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testSpecies() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "Farm", "Europe", "Viviparous", 0);
+		manager.addSpecies("MAMMAL", "BROWN BEAR", "Forest", "America - Asia - Europa", "Viviparous", 0);
+		manager.addSpecies("MAMMAL", "DOLPHIN", "Sea", "Africa - America - Asia", "Viviparous", 0);
+		
+		Iterador<Species> species = manager.species("MAMMAL");
+
+		List<Species> speciesList = new ArrayList<Species>();
+		StringBuffer sb=new StringBuffer();
+		while(species.hiHaSeguent()){
+			speciesList.add(species.seguent());
+		}	
+		
+		Collections.sort(speciesList, new SpeciesComparatorById());
+		
+		for (Species oneSpecies : speciesList) {
+			sb.append(oneSpecies.toString());
+			sb.append(LS);
+		}
+		
+		assertEquals("speciesId: BROWN BEAR" + LS + "rating: MAMMAL" + LS 
+				+ "habitat: Forest" + LS  + "areaOfOrigin: America - Asia - Europa" + LS 
+				+ "reproduction: Viviparous" + LS + 
+				"visits: 0" + LS + "risk level: LEAST CONCERN" + LS + LS
+				+ "speciesId: CATALAN DONKEY" + LS + "rating: MAMMAL" + LS 
+				+ "habitat: Farm" + LS + "areaOfOrigin: Europe" + LS 
+				+ "reproduction: Viviparous" + LS +  
+				"visits: 0" + LS + "risk level: LEAST CONCERN" + LS + LS 
+				+ "speciesId: DOLPHIN" + LS + "rating: MAMMAL" + LS + "habitat: Sea" + LS 
+				+ "areaOfOrigin: Africa - America - Asia" + LS 
+				+ "reproduction: Viviparous" + LS +
+				"visits: 0" + LS + "risk level: LEAST CONCERN" + LS + LS,
+				sb.toString());
+	}
+
+	@Test
+	public void testThatAddAnimalRaisesAnExceptionIfRatingIsNotFound(){
+		manager.addRating("MAMMAL", "description");
+		try {
+			manager.addRiskLevel(0, "LEAST CONCERN");
+			manager.addSpecies("MAMMAL", "perro", "HOME", "BCN", "WHEN_IT_CAN", 0);
+			manager.addAnimal("pipo", "INSECT", "perro", 2);
+			fail("No exception caught :(");
+		} catch (EIException e) {
+			assertEquals(Messages.RATING_NOT_EXIST, e.getMessage());
+		}
+	}
+
+	@Test
+	public void testThatAddAnimalRaisesAnExceptionIfThereAreNoRatings(){
+		try {
+			manager.addAnimal("pipo", "INSECT", "perro", 2);
+			fail("No exception caught :(");
+		} catch (EIException e) {
+			assertEquals(Messages.NO_RATINGS, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testThatAddAnimalRaisesAnExceptionIfSpeciesIsNotFound(){
+		manager.addRating("MAMMAL", "description");
+		try {
+			manager.addRiskLevel(0, "LEAST CONCERN");
+			manager.addSpecies("MAMMAL", "perro", "HOME", "BCN", "WHEN_IT_CAN", 0);
+			manager.addAnimal("pipo", "MAMMAL", "gato", 2);
+			fail("No exception caught :(");
+		} catch (EIException e) {
+			assertEquals(Messages.SPECIES_NOT_EXIST, e.getMessage());
+		}
+	}
+
+	@Test
+	public void testThatAnimalsRaisesAnExceptionWhenThereAreNoRatings() {
+		try {
+			manager.animals();
+			fail("No exception caught :(");
+		} catch (EIException e) {
+			assertEquals(Messages.NO_RATINGS, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testThatAnimalsRaisesAnExceptionWhenThereAreNoAnimals() {
+		manager.addRating("MAMMAL", "description");
+		
+		try {
+			manager.addRiskLevel(0, "LEAST CONCERN");
+			manager.addSpecies("MAMMAL", "pulpo", "HOME", "BCN", "WHEN_IT_CAN", 0);
+			manager.animals();
+			fail("No exception caught :(");
+		} catch (EIException e) {
+			assertEquals(Messages.NO_ANIMAL, e.getMessage());
+		}
+	}
+
+	@Test
+	public void testAnimals() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRating("REPTILE", "description");
+		manager.addRating("BIRD", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 0);
+		manager.addSpecies("REPTILE", "BOA", "", "", "", 0);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addSpecies("BIRD", "OSTRICH", "", "", "", 0);
+		manager.addAnimal("lola", "MAMMAL", "CATALAN DONKEY", 20);
+		manager.addAnimal("pepa", "REPTILE", "BOA", 25);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("trucha", "BIRD", "OSTRICH", 43);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 32);
+		manager.addAnimal("kilo", "MAMMAL", "ZEBRA", 22);
+		manager.addAnimal("kiko", "MAMMAL", "ZEBRA", 56);
+		
+		Iterador<Animal> animals = manager.animals();
+		
+		List<Animal> animalsList = new ArrayList<Animal>();
+		StringBuffer sb=new StringBuffer();
+		while(animals.hiHaSeguent()){
+			animalsList.add(animals.seguent());
+		}
+		
+		Collections.sort(animalsList, new AnimalComparatorByName());
+		
+		for (Animal animal : animalsList) {
+			sb.append(animal.toString());
+			sb.append(LS);
+		}
+		
+		assertEquals("name:kela" + LS + "age: 32" + LS + "rating: MAMMAL" + LS + "speciesId: ZEBRA" + LS + LS
+				+ "name:kiko" + LS + "age: 56" + LS + "rating: MAMMAL" + LS + "speciesId: ZEBRA" + LS + LS 
+				+ "name:kilo" + LS + "age: 22" + LS + "rating: MAMMAL" + LS + "speciesId: ZEBRA" + LS + LS
+				+ "name:lola" + LS + "age: 20" + LS + "rating: MAMMAL" + LS + "speciesId: CATALAN DONKEY" + LS + LS
+				+ "name:pepa" + LS + "age: 25" + LS + "rating: REPTILE" + LS + "speciesId: BOA" + LS + LS 
+				+ "name:trucha" + LS + "age: 43" + LS + "rating: BIRD" + LS + "speciesId: OSTRICH" + LS + LS,
+				sb.toString());
+	}
+	
+	@Test
+	public void testgetMAMMALS() throws EIException {
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addRating("MAMMAL", "description");
+		manager.addRating("REPTILE", "description");
+		manager.addRating("BIRD", "description");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 0);
+		manager.addSpecies("REPTILE", "BOA", "", "", "", 0);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addSpecies("BIRD", "OSTRICH", "", "", "", 0);
+		manager.addAnimal("lola", "MAMMAL", "CATALAN DONKEY", 20);
+		manager.addAnimal("pepa", "REPTILE", "BOA", 25);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("trucha", "BIRD", "OSTRICH", 43);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 32);
+		manager.addAnimal("kilo", "MAMMAL", "ZEBRA", 22);
+		manager.addAnimal("kiko", "MAMMAL", "ZEBRA", 56);
+		
+		Iterador<Animal> animals = manager.animalsByRating("MAMMAL");
+		
+		List<Animal> animalsList = new ArrayList<Animal>();
+		StringBuffer sb=new StringBuffer();
+		while(animals.hiHaSeguent()){
+			animalsList.add(animals.seguent());
+		}
+		
+		Collections.sort(animalsList, new AnimalComparatorByName());
+		
+		for (Animal animal : animalsList) {
+			sb.append(animal.toString());
+			sb.append(LS);
+		}
+		
+		assertEquals("name:kela" + LS + "age: 32" + LS + "rating: MAMMAL" + LS + "speciesId: ZEBRA" + LS + LS
+				+ "name:kiko" + LS + "age: 56" + LS + "rating: MAMMAL" + LS + "speciesId: ZEBRA" + LS + LS
+				+ "name:kilo" + LS + "age: 22" + LS + "rating: MAMMAL" + LS + "speciesId: ZEBRA" + LS + LS
+				+ "name:lola" + LS + "age: 20" + LS + "rating: MAMMAL" + LS + "speciesId: CATALAN DONKEY" + LS + LS,
+				sb.toString());
+	}
+
+	@Test
+	public void testgetREPTIL() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRating("REPTILE", "description");
+		manager.addRating("BIRD", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 0);
+		manager.addSpecies("REPTILE", "BOA", "", "", "", 0);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addSpecies("BIRD", "OSTRICH", "", "", "", 0);
+		manager.addAnimal("lola", "MAMMAL", "CATALAN DONKEY", 20);
+		manager.addAnimal("pepa", "REPTILE", "BOA", 25);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("trucha", "BIRD", "OSTRICH", 43);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 32);
+		manager.addAnimal("kilo", "MAMMAL", "ZEBRA", 22);
+		manager.addAnimal("kiko", "MAMMAL", "ZEBRA", 56);
+		
+		Iterador<Animal> animals = manager.animalsByRating("REPTILE");
+		
+		StringBuffer sb=new StringBuffer();
+		while(animals.hiHaSeguent()){
+			sb.append(animals.seguent().toString());
+			sb.append(LS);
+		}
+		assertEquals("name:pepa" + LS + "age: 25" + LS + "rating: REPTILE" + LS + "speciesId: BOA" + LS + LS, 
+				sb.toString());
+	}
+
+	@Test
+	public void testgetZebra() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRating("REPTILE", "description");
+		manager.addRating("BIRD", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 0);
+		manager.addSpecies("REPTILE", "BOA", "", "", "", 0);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addSpecies("BIRD", "OSTRICH", "", "", "", 0);
+		manager.addAnimal("lola", "MAMMAL", "CATALAN DONKEY", 20);
+		manager.addAnimal("pepa", "REPTILE", "BOA", 25);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("trucha", "BIRD", "OSTRICH", 43);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 32);
+		manager.addAnimal("kilo", "MAMMAL", "ZEBRA", 22);
+		manager.addAnimal("kiko", "MAMMAL", "ZEBRA", 56);
+		
+		Iterador<Animal> animals = manager.animalsBySpecies("MAMMAL", "ZEBRA");
+
+		List<Animal> animalsList = new ArrayList<Animal>();
+		StringBuffer sb=new StringBuffer();
+		while(animals.hiHaSeguent()){
+			animalsList.add(animals.seguent());
+		}
+		
+		Collections.sort(animalsList, new AnimalComparatorByName());
+		
+		for (Animal animal : animalsList) {
+			sb.append(animal.toString());
+			sb.append(LS);
+		}
+			
+		assertEquals("name:kela" + LS + "age: 32" + LS + "rating: MAMMAL" + LS + "speciesId: ZEBRA" + LS + LS
+				+ "name:kiko" + LS + "age: 56" + LS + "rating: MAMMAL" + LS + "speciesId: ZEBRA" + LS + LS
+				+ "name:kilo" + LS + "age: 22" + LS + "rating: MAMMAL" + LS + "speciesId: ZEBRA" + LS + LS,
+				sb.toString());
+	}
+
+	@Test
+	public void testAddRiskLevel() throws EIException {
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addRiskLevel(1, "VULNERABLE");
+		manager.addRiskLevel(2, "CRITICALLY ENDARGERED");
+		manager.addRiskLevel(3, "EXTINCT");
+		assertEquals("LEAST CONCERN", manager.getRiskLevel(0).getName());
+		assertEquals("VULNERABLE", manager.getRiskLevel(1).getName());
+		assertEquals("CRITICALLY ENDARGERED", manager.getRiskLevel(2).getName());
+		assertEquals("EXTINCT", manager.getRiskLevel(3).getName());
+	}
+
+	@Test
+	public void testThatAddRiskLevelThrowsAnExceptionWhenTheRiskLevelAlreadyExists() {
+		try {
+			manager.addRiskLevel(0, "LEAST CONCERN");
+			manager.addRiskLevel(0, "LEAST CONCERN");
+		}  catch (EIException e) {
+			assertEquals(Messages.RISK_LEVEL_ALREADY_EXISTS, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testThatAddRiskLevelThrowsAnExceptionWhenTheRiskLevelNameIsUnknown() {
+		try {
+			manager.addRiskLevel(0, "xxx");
+		}  catch (EIException e) {
+			assertEquals(Messages.UNKNOWN_RISK_LEVEL, e.getMessage());
+		}
+	}
+
+	@Test
+	public void testRiskLevels()  throws EIException {
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addRiskLevel(1, "VULNERABLE");
+		manager.addRiskLevel(2, "CRITICALLY ENDARGERED");
+		manager.addRiskLevel(3, "EXTINCT");
+
+		
+		Iterador<RiskLevel> riskLevels = manager.riskLevels();
+		
+		
+		StringBuffer sb=new StringBuffer();
+		while(riskLevels.hiHaSeguent()){
+			sb.append(riskLevels.seguent().toString());
+			sb.append(LS);
+		}
+		
+		assertEquals("LEAST CONCERN" + LS + 
+				     "VULNERABLE" + LS + 
+				     "CRITICALLY ENDARGERED" + LS + 
+				     "EXTINCT" + LS,
+					 sb.toString());
+	}
+
+
+	@Test
+	public void testGetAnimal() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRating("REPTILE", "description");
+		manager.addRating("BIRD", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 0);
+		manager.addSpecies("REPTILE", "BOA", "", "", "", 0);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addSpecies("BIRD", "OSTRICH", "", "", "", 0);
+		manager.addAnimal("lola", "MAMMAL", "CATALAN DONKEY", 20);
+		manager.addAnimal("pepa", "REPTILE", "BOA", 25);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("trucha", "BIRD", "OSTRICH", 43);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 32);
+		manager.addAnimal("kilo", "MAMMAL", "ZEBRA", 22);
+		manager.addAnimal("kiko", "MAMMAL", "ZEBRA", 56);
+		
+		Animal animal = manager.getAnimal("kela");
+		
+		assertEquals("kela", animal.getName());
+		assertEquals("MAMMAL", animal.getRatingId());
+		assertEquals("ZEBRA", animal.getSpeciesId());
+		assertEquals(32, animal.getAge());
+		assertEquals(0, animal.getRiskLevel());
+	}
+	
+	@Test
+	public void testThatGetAnimalThrowsAnExceptionWhenTheAnimalDoesNotExist() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRating("REPTILE", "description");
+		manager.addRating("BIRD", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 0);
+		manager.addSpecies("REPTILE", "BOA", "", "", "", 0);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addSpecies("BIRD", "OSTRICH", "", "", "", 0);
+		manager.addAnimal("lola", "MAMMAL", "CATALAN DONKEY", 20);
+		manager.addAnimal("pepa", "REPTILE", "BOA", 25);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("trucha", "BIRD", "OSTRICH", 43);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 32);
+		manager.addAnimal("kilo", "MAMMAL", "ZEBRA", 22);
+		manager.addAnimal("kiko", "MAMMAL", "ZEBRA", 56);
+		
+		try {
+			manager.getAnimal("no existo");
+		} catch (EIException e) {
+			assertEquals(Messages.ANIMAL_NOT_EXIST, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testAddVeterinaryAttention() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 0);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		
+		manager.addVeterinaryAttention("kela", 1);
+	}
+	
+	@Test
+	public void testThatAddVeterinaryAttentionThrowsAnExceptionIfTheAnimalDoesNotExist() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 0);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		
+		try {
+			manager.addVeterinaryAttention("no existo", 1);
+		} catch (EIException e) {
+			assertEquals(Messages.ANIMAL_NOT_EXIST, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testThatAddVeterinaryAttentionThrowsAnExceptionIfTheSeverityValueIsNotValid() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 0);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		
+		try {
+			manager.addVeterinaryAttention("kela", 6);
+		} catch (EIException e) {
+			assertEquals(Messages.INVALID_SEVERITY_VALUE, e.getMessage());
+		}
+		
+		try {
+			manager.addVeterinaryAttention("kela", 0);
+		} catch (EIException e) {
+			assertEquals(Messages.INVALID_SEVERITY_VALUE, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testNextVeterinaryAttention() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addRiskLevel(1, "VULNERABLE");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 1);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("kola", "MAMMAL", "ZEBRA", 36);
+		manager.addAnimal("pipo", "MAMMAL", "CATALAN DONKEY", 2);
+		manager.addAnimal("fefo", "MAMMAL", "CATALAN DONKEY", 3);
+		manager.addAnimal("mimo", "MAMMAL", "ZEBRA", 31);
+		
+		manager.addVeterinaryAttention("kela", 1);
+		manager.addVeterinaryAttention("pipo", 4);
+		manager.addVeterinaryAttention("kola", 1);
+		manager.addVeterinaryAttention("fefo", 4);
+		manager.addVeterinaryAttention("mimo", 5);
+		
+		try {
+		
+			VeterinaryAttention next = manager.nextVeterinaryAttention();
+			assertEquals("mimo", next.getAnimalName());
+			
+			next = manager.nextVeterinaryAttention();
+			assertEquals("fefo", next.getAnimalName());
+			
+			next = manager.nextVeterinaryAttention();
+			assertEquals("pipo", next.getAnimalName());
+			
+			next = manager.nextVeterinaryAttention();
+			assertEquals("kola", next.getAnimalName());
+			
+			next = manager.nextVeterinaryAttention();
+			assertEquals("kela", next.getAnimalName());
+		} catch (EIException e) {
+			assertEquals(Messages.NO_VETERINARY_ATENTTIONS, e.getMessage());
+		}
+	}
+
+	@Test
+	public void testAddVisitor() throws EIException {
+		manager.addVisitor("1234", "Pepe");
+	}
+	
+	@Test
+	public void testThatAddVisitorThrowsAnExceptionIfTheVisitorWasAlreadyAdded() {
+		try {
+			manager.addVisitor("1234", "Pepe");
+			manager.addVisitor("1234", "Pepe");
+		} catch (EIException e) {
+			assertEquals(Messages.VISITOR_ALREADY_EXISTS, e.getMessage());
+		}
+	}
+
+	@Test
+	public void testVisitors() throws EIException {
+		List<String> listNifs = Arrays.asList("1234", "123A", "23A", "523A", "A1", "Z1", "91", "01"); 
+		
+		for(String elem : listNifs)
+			manager.addVisitor(elem, "Pepe");
+
+		Iterador<Visitor> iterVisitors = manager.visitors();
+				
+		List<String> sortedListNifs = new ArrayList<String>();
+		while(iterVisitors.hiHaSeguent()) {
+			sortedListNifs.add(iterVisitors.seguent().getNif());
+		}
+			
+		assertEquals("01", sortedListNifs.get(0));
+		assertEquals("1234", sortedListNifs.get(1));
+		assertEquals("123A", sortedListNifs.get(2));
+		assertEquals("23A", sortedListNifs.get(3));
+		assertEquals("523A", sortedListNifs.get(4));
+		assertEquals("91", sortedListNifs.get(5));
+		assertEquals("A1", sortedListNifs.get(6));
+		assertEquals("Z1", sortedListNifs.get(7));
+	}
+	
+	
+	@Test
+	public void testThatVisitorsThrowsAnExceptionIfEmpty() throws EIException {
+		try {
+			manager.visitors();
+		} catch (EIException e) {
+			assertEquals(Messages.NO_VISITORS, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testGetVisitor() throws EIException {
+		List<String> listNifs = Arrays.asList("1234", "123A", "23A", "523A", "A1", "Z1", "91", "01"); 
+		
+		int i=0;
+		for(String elem : listNifs) {
+			manager.addVisitor(elem, "visitor_" + i);
+			i++;
+		}		
+		
+		Visitor visitor = manager.getVisitor("A1");
+		
+		assertEquals("A1", visitor.getNif());
+	}
+	
+	@Test
+	public void testthatGetVisitorThrowsAnExceptionIfTheVisitordoesNotExist() throws EIException {
+		List<String> listNifs = Arrays.asList("1234", "123A", "23A", "523A", "A1", "Z1", "91", "01"); 
+		
+		int i=0;
+		for(String elem : listNifs) {
+			manager.addVisitor(elem, "visitor_" + i);
+			i++;
+		}		
+		
+		try {
+			manager.getVisitor("X1");
+		}catch (EIException e) {
+			assertEquals(Messages.VISITOR_NOT_EXISTS, e.getMessage());	
+		}
+	}
+	
+	@Test
+	public void testVisit() throws EIException {
+		manager.addVisitor("4321", "Pedro");
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		
+		manager.visit("4321", "kela"); 
+	}
+	
+	@Test
+	public void testThatVisitThrowsAnExceptionIfTheVisitorDoesNotExist() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+
+		try {
+			manager.visit("4321", "kela");
+		} catch(EIException e) {
+			assertEquals(Messages.VISITOR_NOT_EXISTS, e.getMessage());
+		}
+	}
+
+	@Test
+	public void testThatVisitThrowsAnExceptionIfTheAnimalDoesNotExist() throws EIException {
+		manager.addVisitor("4321", "Pedro");
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+
+		try {
+			manager.visit("4321", "kela");
+		} catch(EIException e) {
+			assertEquals(Messages.ANIMAL_NOT_EXIST, e.getMessage());
+		}
+	}
+
+	@Test
+	public void testVisitedAnimals() throws EIException {
+		manager.addVisitor("4321", "Pedro");
+		manager.addVisitor("5321", "Pol");
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("pela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("tela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("lela", "MAMMAL", "ZEBRA", 35);
+		manager.visit("4321", "kela"); 
+		manager.visit("5321", "kela");
+		manager.visit("5321", "tela");
+		manager.visit("5321", "lela");
+		manager.visit("4321", "lela");
+		manager.visit("5321", "pela");
+		
+		Iterador<Animal> animals = manager.visitedAnimals("5321");
+		
+		assertEquals(4, manager.getVisitor("5321").getVisits());
+		assertEquals("pela", animals.seguent().getName());
+		assertEquals("lela", animals.seguent().getName());
+		assertEquals("tela", animals.seguent().getName());
+		assertEquals("kela", animals.seguent().getName());
+	}
+	
+	@Test
+	public void testThatVisitedAnimalsThrowsAnExceptionIfThereAreNoAnimals() throws EIException {
+		manager.addVisitor("5321", "Pol");
+		try {
+			manager.visitedAnimals("5321");
+		} catch (EIException e) {
+			assertEquals(Messages.NO_ANIMAL, e.getMessage());			
+		}
+	}
+	
+	@Test
+	public void testThatVisitedAnimalsThrowsAnExceptionIfTheVisitorDoesNotExist() throws EIException {
+		try {
+			manager.visitedAnimals("5321");
+		} catch (EIException e) {
+			assertEquals(Messages.VISITOR_NOT_EXISTS, e.getMessage());			
+		}
+	}
+	
+	@Test
+	public void testMostVisitedSpecies() throws EIException {
+		manager.addVisitor("5321", "Pol");
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addSpecies("MAMMAL", "LEMUR", "", "", "", 0);
+		manager.addSpecies("MAMMAL", "DOLPHIN", "", "", "", 0);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("koko", "MAMMAL", "LEMUR", 35);
+		manager.addAnimal("brian", "MAMMAL", "DOLPHIN", 35);
+		
+		manager.visit("5321", "kela");
+		manager.visit("5321", "kela");
+		manager.visit("5321", "kela");
+		
+		manager.visit("5321", "koko");
+		manager.visit("5321", "koko");
+		manager.visit("5321", "koko");
+		manager.visit("5321", "koko");
+		
+		manager.visit("5321", "brian");
+		manager.visit("5321", "brian");
+		manager.visit("5321", "brian");
+		manager.visit("5321", "brian");
+		manager.visit("5321", "brian");
+		
+		assertEquals("DOLPHIN", manager.mostVisitedSpecies().getId());
+		assertEquals(5, manager.mostVisitedSpecies().getVisits());
+		
+		manager.visit("5321", "koko");
+		manager.visit("5321", "koko");
+		
+		assertEquals("LEMUR", manager.mostVisitedSpecies().getId());
+		assertEquals(6, manager.mostVisitedSpecies().getVisits());
+		
+		manager.visit("5321", "kela");
+		manager.visit("5321", "kela");
+		manager.visit("5321", "kela");
+		manager.visit("5321", "kela");
+		manager.visit("5321", "kela");
+		manager.visit("5321", "kela");
+		
+		assertEquals("ZEBRA", manager.mostVisitedSpecies().getId());	
+		assertEquals(9, manager.mostVisitedSpecies().getVisits());
+	}
+	
+	@Test
+	public void testThatMostVisitedSpeciesThrowsAnExceptionWhenThereAreNovisits() throws EIException {
+		manager.addVisitor("5321", "Pol");
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		
+		try {
+			manager.mostVisitedSpecies();
+		} catch(EIException e) {
+			assertEquals(Messages.NO_VISITS, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testBestVisitors() throws EIException {
+		manager.addVisitor("4321", "Pedro");
+		manager.addVisitor("5321", "Pol");
+		manager.addVisitor("6321", "Kiko");
+		manager.addVisitor("7321", "Brian");
+		manager.addVisitor("8321", "Molo");
+		manager.addRating("MAMMAL", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 0);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		manager.visit("4321", "kela");
+		manager.visit("4321", "kela");
+		
+		manager.visit("5321", "kela");
+		
+		manager.visit("7321", "kela");
+		manager.visit("7321", "kela");
+		manager.visit("7321", "kela");
+		
+		manager.visit("6321", "kela");
+		manager.visit("6321", "kela");
+		manager.visit("6321", "kela");
+		manager.visit("6321", "kela");
+		
+		manager.visit("8321", "kela");
+		manager.visit("8321", "kela");
+		manager.visit("8321", "kela");
+		manager.visit("8321", "kela");
+		manager.visit("8321", "kela");
+
+		Iterador<Visitor> iterBestOnes = manager.bestVisitors();
+		
+		assertEquals("Molo", iterBestOnes.seguent().getName());
+		assertEquals("Kiko", iterBestOnes.seguent().getName());
+		assertEquals("Brian", iterBestOnes.seguent().getName());
+	}
+	
+	@Test
+	public void testThatBestVisitorsRaisesExceptionWhenThereAreNovisitors() {
+		try {
+			manager.bestVisitors();
+		} catch (EIException e) {
+			assertEquals(Messages.NO_VISITORS, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testAnimalsRiskLevel() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRating("REPTILE", "description");
+		manager.addRating("BIRD", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addRiskLevel(1, "VULNERABLE");
+		manager.addRiskLevel(2, "CRITICALLY ENDARGERED");
+		manager.addRiskLevel(3, "EXTINCT");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 0);
+		manager.addSpecies("REPTILE", "BOA", "", "", "", 1);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 2);
+		manager.addSpecies("BIRD", "OSTRICH", "", "", "", 3);
+		manager.addSpecies("MAMMAL", "RUSSIAN DONKEY", "", "", "", 3);
+		manager.addSpecies("REPTILE", "LIZARD", "", "", "", 2);
+		manager.addSpecies("MAMMAL", "COW", "", "", "", 1);
+		manager.addSpecies("BIRD", "PARROT", "", "", "", 0);
+
+		manager.addAnimal("lola", "MAMMAL", "CATALAN DONKEY", 20);
+		manager.addAnimal("pepa", "REPTILE", "BOA", 25);
+		manager.addAnimal("kela", "MAMMAL", "ZEBRA", 35);
+		manager.addAnimal("trucha", "BIRD", "OSTRICH", 43);
+		manager.addAnimal("kela", "MAMMAL", "RUSSIAN DONKEY", 32);
+		manager.addAnimal("kilo", "REPTILE", "LIZARD", 22);
+		manager.addAnimal("kiko", "MAMMAL", "COW", 56);		
+		manager.addAnimal("juan", "BIRD", "PARROT", 56);	
+		
+		Iterador<Animal> iterAnimals = manager.animalsRiskLevel(0);
+		
+		while(iterAnimals.hiHaSeguent()) {
+			assertEquals(0, iterAnimals.seguent().getRiskLevel());
+		}
+		
+		iterAnimals = manager.animalsRiskLevel(1);
+		
+		while(iterAnimals.hiHaSeguent()) {
+			assertEquals(1, iterAnimals.seguent().getRiskLevel());
+		}
+		
+		iterAnimals = manager.animalsRiskLevel(2);
+		
+		while(iterAnimals.hiHaSeguent()) {
+			assertEquals(2, iterAnimals.seguent().getRiskLevel());
+		}
+		
+		iterAnimals = manager.animalsRiskLevel(3);
+		
+		while(iterAnimals.hiHaSeguent()) {
+			assertEquals(3, iterAnimals.seguent().getRiskLevel());
+		}
+	}
+	
+	@Test
+	public void testThatAnimalsRiskLevelRaisesExceptioWhenThereAreNoAnimals() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRating("REPTILE", "description");
+		manager.addRating("BIRD", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addRiskLevel(1, "VULNERABLE");
+		manager.addRiskLevel(2, "CRITICALLY ENDARGERED");
+		manager.addRiskLevel(3, "EXTINCT");
+		manager.addSpecies("MAMMAL", "CATALAN DONKEY", "", "", "", 0);
+		manager.addSpecies("REPTILE", "BOA", "", "", "", 1);
+		manager.addSpecies("MAMMAL", "ZEBRA", "", "", "", 2);
+		manager.addSpecies("BIRD", "OSTRICH", "", "", "", 3);
+		manager.addSpecies("MAMMAL", "RUSSIAN DONKEY", "", "", "", 3);
+		manager.addSpecies("REPTILE", "LIZARD", "", "", "", 2);
+		manager.addSpecies("MAMMAL", "COW", "", "", "", 1);
+		manager.addSpecies("BIRD", "PARROT", "", "", "", 0);
+		
+		try {
+			manager.animalsRiskLevel(0);
+		} catch (EIException e) {
+			assertEquals(Messages.NO_ANIMAL, e.getMessage());
+		}
+	}
+	
+	@Test
+	public void testThatAnimalsRiskLevelRaisesExceptioWhenThereAreNoSpecies() throws EIException {
+		manager.addRating("MAMMAL", "description");
+		manager.addRating("REPTILE", "description");
+		manager.addRating("BIRD", "description");
+		manager.addRiskLevel(0, "LEAST CONCERN");
+		manager.addRiskLevel(1, "VULNERABLE");
+		manager.addRiskLevel(2, "CRITICALLY ENDARGERED");
+		manager.addRiskLevel(3, "EXTINCT");
+		
+		try {
+			manager.animalsRiskLevel(0);
+		} catch (EIException e) {
+			assertEquals(Messages.NO_ANIMAL, e.getMessage());
+		}
+	}
+}

File src/uoc/ei/practica/Animal.java

+package uoc.ei.practica;
+
+/**
+ * Clase que modela un animal del sistema
+ * 
+ * @author mriverog
+ *
+ */
+
+public class Animal {
+
+	private String name;
+	private int age;
+	private Rating rating;
+	private Species species;
+
+	private final String LS = System.getProperty("line.separator");
+	
+	public Animal(Rating rating, Species species, String name, int age) {
+		this.name = name;
+		this.age = age;
+		this.rating = rating;
+		this.species = species;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public int getAge() {
+		return age;
+	}
+
+	public String getRatingId() {
+		return rating.getId();
+	}
+
+	public String getSpeciesId() {
+		return species.getId();
+	}
+	
+	public int getRiskLevel() {
+		return species.getRiskLevel().getId();
+	}
+
+	@Override
+	public String toString() {
+		return 	"name:" + name + LS + "age: " + age + LS + "rating: " + rating.getId() 
+				+ LS + "speciesId: " + species.getId() + LS;
+	}
+
+	public Species getSpecies() {
+		return species;
+	}
+}
+ 

File src/uoc/ei/practica/BestOnes.java

+package uoc.ei.practica;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+import uoc.ei.tads.Iterador;
+import uoc.ei.tads.IteradorVectorImpl;
+
+/**
+ * Clase que modela la élite entre los objetos de un determinado tipo.
+ * 
+ * Esta implementación sólo tiene sentido para N pequeño, como en el caso de 
+ * los bestVisitors (N=4) en esta práctica.
+ * 
+ * @author mriverog
+ *
+ */
+
+public class BestOnes<T> {
+	
+	//private ArrayList<T> bestOnesList;
+	private Comparator<T> comparator;
+	private int bestOnesNumber;
+	private T bestOnesArray[];
+	private int numElements;
+	
+	@SuppressWarnings("unchecked")
+	public BestOnes(int bestOnesNumber, Comparator<T> comparator) {
+		this.bestOnesNumber = bestOnesNumber;
+		bestOnesArray = (T[]) new Object[bestOnesNumber];
+		numElements = 0;
+		this.comparator = comparator;
+	}
+
+	public void addElement(T newElement) {
+		if(isAlreadyContained(newElement)) {
+			Arrays.sort(bestOnesArray, comparator);
+		} else {
+			addNewElement(newElement);
+		}
+	}
+	
+	private boolean isAlreadyContained(T newElement) {
+		for(T element : this.bestOnesArray) {
+			if(newElement.equals(element))
+				return true;
+		}
+		return false;
+	}
+	
+	public Iterador<T> getBestOnes() {
+		Iterador<T> iterBestOnes = new IteradorVectorImpl<T>(bestOnesArray, 3, 0);
+		return iterBestOnes;
+	}
+
+	public boolean isEmpty() {
+		return numElements == 0;
+	}
+	
+	private void addNewElement(T newElement) {
+		if(numElements < bestOnesNumber) {
+			addNewElement(newElement, numElements);
+			Arrays.sort(bestOnesArray, comparator);
+		} else {
+			T lastOne = bestOnesArray[lastElementIndex()]; 		
+			if(comparator.compare(newElement, lastOne) == -1) {
+				bestOnesArray[lastElementIndex()] = newElement;
+				Arrays.sort(bestOnesArray, comparator);
+			}
+		}
+	}
+	
+	private void addNewElement(T newElement, int index) {
+		bestOnesArray[numElements] = newElement;
+		numElements++;
+	}
+	
+	private int lastElementIndex() {
+		return numElements-1;
+	}
+}
+
+

File src/uoc/ei/practica/EIException.java

+package uoc.ei.practica;
+
+/**
+ * Excepció específica del gestor.
+ *
+ * @author   Equip docent d'Estructura de la Informació de la UOC
+ * @version  Tardor 2006
+ */
+public class EIException  extends Exception
+{
+
+	private static final long serialVersionUID = -2577150645305791318L;
+
+/**
+    * Constructor amb un paràmetre.
+    * @param msg  missatge que ha de mostrar l'excepció
+    */
+   public EIException(String msg) { super(msg); }
+}

File src/uoc/ei/practica/Messages.java

+package uoc.ei.practica;
+
+/** Interfície que defineix tots els missatges necessaris per a les excepcions generades
+ *
+ * @author   Equip docent d'Estructura de la Informació de la UOC
+ * @version  Tardor 2011-2012
+ */
+public interface Messages {
+	public static final String RATING_NOT_EXIST ="Rating doesn't found";
+	public static final String NO_RATINGS ="There are no ratings";
+	public static final String SPECIES_NOT_EXIST = "Species doesn't found";	
+	public static final String ANIMAL_NOT_EXIST ="Animal doesn't found";
+	public static final String ANIMAL_EXCEDEED = "Has exceeded the number of animals";
+	
+	public static final String NO_SPECIES = "There are no species";
+	public static final String NO_ANIMAL = "There are no animals";
+	
+	
+	public static final String LS = System.getProperty("line.separator");
+	public static final String PREFIX = "\t";
+
+	public static final String RISK_LEVEL_ALREADY_EXISTS = "Risk level already exist";
+	public static final String UNKNOWN_RISK_LEVEL = "Unknown risk level";
+	public static final String INVALID_SEVERITY_VALUE = "Invalid severity value";
+	public static final String NO_VETERINARY_ATENTTIONS = "There are no veterinary attentions";
+	public static final String VISITOR_ALREADY_EXISTS = "Visitor already exist";
+	public static final String NO_VISITORS = "There are no visitors";
+	public static final String VISITOR_NOT_EXISTS = "Visitor doesn't found";
+	public static final String NO_VISITS = "There are no visits yet";
+	 
+}

File src/uoc/ei/practica/Rating.java

+package uoc.ei.practica;
+
+import uoc.ei.tads.Diccionari;
+import uoc.ei.tads.DiccionariAVLImpl;
+import uoc.ei.tads.DiccionariLlistaImpl;
+import uoc.ei.tads.DiccionariVectorImpl;
+import uoc.ei.tads.Iterador;
+import uoc.ei.tads.LlistaEncadenada;
+
+/**
+ * Clase que modela una clasificación.
+ * 
+ * @author mriverog
+ *
+ */
+
+public class Rating {
+
+	private final String LS = System.getProperty("line.separator");
+	
+	private String id;
+	private String description;
+
+	private Diccionari<String, Species> speciesDictionary;
+	
+	public Rating(String id, String description) {
+		this.id = id;
+		this.description = description;
+		
+		this.speciesDictionary = new DiccionariAVLImpl<String, Species>();
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	@Override
+	public boolean equals(java.lang.Object obj) {
+		Rating otherRating = (Rating) obj;
+		return this.id.equals(otherRating.getId());
+	}
+
+	@Override
+	public String toString() {
+		return "id: " + id  + LS +  description + LS;