Skip to content

Commit

Permalink
Merge branch 'master' into issue-5
Browse files Browse the repository at this point in the history
  • Loading branch information
wallysoncarvalho authored Nov 5, 2020
2 parents 5750166 + c515a36 commit 651c2e6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import info.wallyson.exception.ApiException;
import info.wallyson.service.ExerciseService;
import info.wallyson.validations.exerciseimage.ValidExerciseImage;
import java.util.List;
import java.util.stream.Collectors;
import javax.validation.Valid;
import org.springframework.core.io.FileSystemResource;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
Expand All @@ -21,10 +24,6 @@
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

import javax.validation.Valid;
import java.util.List;
import java.util.stream.Collectors;

@Validated
@RestController
@RequestMapping(value = "/api/v1/exercises")
Expand Down
4 changes: 1 addition & 3 deletions api/src/main/java/info/wallyson/exception/ApiError.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package info.wallyson.exception;

import java.util.Collections;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.http.HttpStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package info.wallyson.exception;

import java.util.HashMap;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -9,8 +10,6 @@
import org.springframework.web.servlet.NoHandlerFoundException;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;

import java.util.HashMap;

@RestControllerAdvice
public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package info.wallyson.exception;

import java.util.List;
import java.util.stream.Collectors;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.WebRequest;

import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import java.util.List;
import java.util.stream.Collectors;

@RestControllerAdvice
public class GeneralExceptionHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import info.wallyson.entity.Exercise;
import info.wallyson.exception.ApiException;
import info.wallyson.repository.ExerciseRepository;

import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Value;
Expand Down
19 changes: 9 additions & 10 deletions api/src/test/java/info/wallyson/service/ExerciseServiceTest.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
package info.wallyson.service;

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;

import info.wallyson.dto.ExerciseDTO;
import info.wallyson.entity.Exercise;
import info.wallyson.exception.ApiException;
import info.wallyson.factory.ExerciseDTOFactory;
import info.wallyson.repository.ExerciseRepository;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.UUID;
import org.hibernate.exception.ConstraintViolationException;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand All @@ -18,16 +27,6 @@
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.UUID;

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;

@DisplayName("Exercise service tests \uD83D\uDE30!")
@ExtendWith(SpringExtension.class)
class ExerciseServiceTest {
Expand Down

0 comments on commit 651c2e6

Please sign in to comment.