Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge pr test #85

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading