BAEL-5253 moving the tests to other module
This commit is contained in:
parent
2a3501237c
commit
9ab2a1ab0f
@ -24,6 +24,11 @@
|
|||||||
<artifactId>commons-validator</artifactId>
|
<artifactId>commons-validator</artifactId>
|
||||||
<version>${validator.version}</version>
|
<version>${validator.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>${guava.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -49,8 +54,8 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<guava.version>28.1-jre</guava.version>
|
<guava.version>31.0.1-jre</guava.version>
|
||||||
<validator.version>1.7</validator.version>
|
<validator.version>1.7</validator.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.baeldung.isuppercase;
|
package com.baeldung.isuppercase;
|
||||||
|
|
||||||
import com.google.common.base.Ascii;
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestInstance;
|
import org.junit.jupiter.api.TestInstance;
|
||||||
|
import com.google.common.base.Ascii;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.matchesPattern;
|
import static org.hamcrest.Matchers.matchesPattern;
|
@ -1,63 +0,0 @@
|
|||||||
package com.baeldung.swagger2pdf.controller;
|
|
||||||
|
|
||||||
import com.baeldung.swagger2pdf.objects.User;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@Api(value = "/api", description = "A controller for user management")
|
|
||||||
@RequestMapping("/user")
|
|
||||||
@ResponseStatus(HttpStatus.OK)
|
|
||||||
public class UserController {
|
|
||||||
|
|
||||||
static List<User> users;
|
|
||||||
|
|
||||||
static {
|
|
||||||
users = new ArrayList<>();
|
|
||||||
users.add(new User("Mark", "Thompson", 23));
|
|
||||||
users.add(new User("Kate", "Jordan", 22));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "Retrieves all the users")
|
|
||||||
@RequestMapping(value = "/users",
|
|
||||||
method = RequestMethod.GET,
|
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public List<User> getUsers() {
|
|
||||||
return users;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "Retrieves a user based on first name")
|
|
||||||
@RequestMapping(value = "/user",
|
|
||||||
method = RequestMethod.GET,
|
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public User getUser(@NonNull @RequestParam String firstName) {
|
|
||||||
|
|
||||||
if (firstName.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return users.stream()
|
|
||||||
.filter(user -> user.getFirstName().equals(firstName))
|
|
||||||
.findAny()
|
|
||||||
.orElse(null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "Adds a user.")
|
|
||||||
@RequestMapping(value = "/user",
|
|
||||||
method = RequestMethod.POST,
|
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public List<User> addUser(@NonNull @RequestBody User user) {
|
|
||||||
users.add(user);
|
|
||||||
return users;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
package com.baeldung.swagger2pdf.objects;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class User {
|
|
||||||
private String firstName;
|
|
||||||
private String lastName;
|
|
||||||
private int age;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user