Commit f153e318 authored by miferreiro's avatar miferreiro

Fixed bugs

- The authentication header has been added to the test of modifying a person's name.
- Updated the name of the PetDAO class to PetsDAO in the Pets resource.
parent c1945554
...@@ -16,7 +16,7 @@ import javax.ws.rs.core.MediaType; ...@@ -16,7 +16,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import es.uvigo.esei.daa.dao.DAOException; import es.uvigo.esei.daa.dao.DAOException;
import es.uvigo.esei.daa.dao.PetDAO; import es.uvigo.esei.daa.dao.PetsDAO;
import es.uvigo.esei.daa.entities.Person; import es.uvigo.esei.daa.entities.Person;
import es.uvigo.esei.daa.entities.Pet; import es.uvigo.esei.daa.entities.Pet;
...@@ -30,17 +30,17 @@ import es.uvigo.esei.daa.entities.Pet; ...@@ -30,17 +30,17 @@ import es.uvigo.esei.daa.entities.Pet;
public class PetsResource { public class PetsResource {
private final static Logger LOG = Logger.getLogger(PetsResource.class.getName()); private final static Logger LOG = Logger.getLogger(PetsResource.class.getName());
private final PetDAO dao; private final PetsDAO dao;
/** /**
* Constructs a new instance of {@link PetResource}. * Constructs a new instance of {@link PetResource}.
*/ */
public PetsResource() { public PetsResource() {
this(new PetDAO()); this(new PetsDAO());
} }
// Needed for testing purposes // Needed for testing purposes
PetsResource(PetDAO dao) { PetsResource(PetsDAO dao) {
this.dao = dao; this.dao = dao;
} }
...@@ -189,9 +189,6 @@ public class PetsResource { ...@@ -189,9 +189,6 @@ public class PetsResource {
} }
} }
/** /**
* Deletes a pet from the system. * Deletes a pet from the system.
* *
......
...@@ -212,8 +212,8 @@ public class PeopleResourceTest extends JerseyTest { ...@@ -212,8 +212,8 @@ public class PeopleResourceTest extends JerseyTest {
final Form form = new Form(); final Form form = new Form();
form.param("name", newName()); form.param("name", newName());
final Response response = target("people/" + existentId()) final Response response = target("people/" + existentId()).request(MediaType.APPLICATION_JSON_TYPE)
.request(MediaType.APPLICATION_JSON_TYPE) .header("Authorization", "Basic " + userToken(adminLogin()))
.put(entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE)); .put(entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
assertThat(response, hasBadRequestStatus()); assertThat(response, hasBadRequestStatus());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment