Skip to content

Commit

Permalink
damit sonarcloud auch glücklich ist und wir einen cleancode haben 🙈
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabi911 committed Aug 19, 2024
1 parent 1756124 commit 46c0777
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import de.webdev.backend.model.Movie;
import de.webdev.backend.service.MovieService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;


import org.springframework.web.bind.annotation.*;

Expand All @@ -25,12 +25,9 @@ public List<Movie> getMovies() {


@GetMapping("{id}")
public ResponseEntity<Movie> getMovieById(@PathVariable String id) {
Movie movie = movieService.getMovieById(id);
if (movie == null) {
return ResponseEntity.notFound().build();
}
return ResponseEntity.ok(movie);
public Movie getMovieById(@PathVariable String id) {
return movieService.getMovieById(id);

}
@PostMapping()
public Movie postMovie (@RequestBody MovieDto userEntries) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ void getMovie_shouldReturnEmptyList_whenCallInitially() throws Exception {
}


@Test
@DirtiesContext
void getMovieById_shouldReturnNotFound_whenIdDoesNotExist() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get("/api/movies/999"))
.andExpect(MockMvcResultMatchers.status().isNotFound());
}

@Test
@DirtiesContext
Expand Down

0 comments on commit 46c0777

Please sign in to comment.