Skip to content

Commit

Permalink
Merge pull request #85 from abes-esr/develop
Browse files Browse the repository at this point in the history
Merge pr test
  • Loading branch information
SamuelQuetin authored Apr 16, 2024
2 parents d20b127 + 4269148 commit d6c1d20
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>fr.abes</groupId>
<artifactId>sudoc</artifactId>
<version>0.0.9</version>
<version>0.0.10-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sudoc</name>
<description>webservices de récupération de ppns dans le sudoc</description>
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/fr/abes/sudoc/entity/notice/NoticeXml.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ public boolean isNoticeElectronique() {
return get008().startsWith("O");
}

public boolean isNoticeImprimee() {
public boolean isNoticeImprimee() throws ZoneNotFoundException {
if(get008() == null){
throw new ZoneNotFoundException("La Zone 008 n'existe pas");
}
return get008().startsWith("A");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.io.IOException;


@ControllerAdvice
@Order(Ordered.HIGHEST_PRECEDENCE)
@Slf4j
Expand Down Expand Up @@ -58,13 +59,16 @@ protected ResponseEntity<Object> handleHttpRequestMethodNotSupported(HttpRequest
@ExceptionHandler(ZoneNotFoundException.class)
protected ResponseEntity<Object> handleZoneNotFoundException(ZoneNotFoundException ex) {
String error = "Erreur dans la notice récupérée";
log.error(ex.getLocalizedMessage());
return buildResponseEntity(new ApiReturnError(HttpStatus.BAD_REQUEST, error, ex));
}


@ExceptionHandler(IOException.class)
protected ResponseEntity<Object> handleIOException(IOException ex) {
String error = "Erreur dans l'accès aux données";
return buildResponseEntity(new ApiReturnError(HttpStatus.NO_CONTENT, error, ex));
log.error(ex.getLocalizedMessage());
return buildResponseEntity(new ApiReturnError(HttpStatus.BAD_REQUEST, error, ex));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.abes.sudoc.entity.notice;

import fr.abes.sudoc.exception.ZoneNotFoundException;
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -44,7 +45,7 @@ void isNoticeElectronique() {
}

@Test
void isNoticeImprimee() {
void isNoticeImprimee() throws ZoneNotFoundException {
NoticeXml notice = new NoticeXml();
Controlfield controlfield = new Controlfield();
controlfield.setTag("008");
Expand Down

0 comments on commit d6c1d20

Please sign in to comment.