Commit d59424b5 authored by Michael Schimpelsberger's avatar Michael Schimpelsberger
Browse files

some small changes according to tests

parent b0622a7a
......@@ -6,6 +6,7 @@ public class ExceptionParam {
protected static final String SERVER_ERROR="HTTP 500 Internal Server Error";
protected static final String DOKU="https://en.wikipedia.org/wiki/List_of_HTTP_status_codes";
protected static MediaType mediaType;
public static MediaType getMediaType() {
return mediaType;
}
......
......@@ -99,6 +99,7 @@ public class StudentResource {
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getInscriptions(@PathParam("studentMatrNr")int matrNr, @Context HttpHeaders headers) {
ExceptionParam.setMediaType(headers.getMediaType());
dao.getStudent(matrNr);
List<Study>list= dao.getInscriptions(matrNr);
GenericEntity<List<Study>> entity=new GenericEntity<List<Study>>(list) {};
return Response.ok(entity).build();
......@@ -112,7 +113,7 @@ public class StudentResource {
ExceptionParam.setMediaType(headers.getMediaType());
if (study.getName()==null||study.getName().isEmpty()||study.getStudyId()<=0)
throw new BadRequestException();
//check if study exists
dao.getStudent(matrNr);
Study temp=studyDao.getStudy(study.getStudyId());
//if study exists but has different name: BadRequest
if (!temp.getName().equals(study.getName())) {throw new BadRequestException();}
......
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