Skip to content

Commit 3733084

Browse files
committed
adding get genre to test 405 on unsupported verb.
1 parent a47acfa commit 3733084

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
hs_err_pid*
2424
/target/
2525
/.classpath
26+
/trace.txt

src/main/java/fr/fxjavadevblog/aid/api/genre/GenreResource.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
2323
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
2424

25+
import fr.fxjavadevblog.aid.api.exceptions.ResourceNotFoundException;
2526
import fr.fxjavadevblog.aid.api.videogame.VideoGame;
2627
import fr.fxjavadevblog.aid.api.videogame.VideoGameRepository;
2728
import fr.fxjavadevblog.aid.metadata.ApplicationConfig;
@@ -30,6 +31,7 @@
3031
import fr.fxjavadevblog.aid.utils.jaxrs.pagination.QueryParameterUtils;
3132
import fr.fxjavadevblog.aid.utils.pagination.PagedResponse;
3233
import fr.fxjavadevblog.aid.utils.validation.SortableOn;
34+
import fr.fxjavadevblog.preconditions.Checker;
3335
import io.quarkus.hibernate.orm.panache.PanacheQuery;
3436
import io.quarkus.panache.common.Sort;
3537
import lombok.extern.slf4j.Slf4j;
@@ -57,6 +59,19 @@ public class GenreResource
5759
public Genre[] getAllGenres() {
5860
return Genre.values();
5961
}
62+
63+
@GET
64+
@Path("/{genre}")
65+
@Operation(summary = "Return a video game Genre")
66+
@APIResponse(responseCode = "200", description = "OK")
67+
@APIResponse(responseCode = "404", description = "The genre does not exist.", ref = ApplicationConfig.RESPONSE_API_ERROR)
68+
public Response getGenre(@PathParam("genre") final Genre genre)
69+
{
70+
Checker.notNull("Genre", genre, ResourceNotFoundException::new);
71+
return Response.ok(genre).build();
72+
}
73+
74+
6075

6176
@GET
6277
@Operation(summary = "Get games within a genre", description = "Get all video games of the given genre")

0 commit comments

Comments
 (0)