+++ /dev/null
-package de.juplo.demos.consumer.adapter;
-
-import de.juplo.demos.consumer.domain.User;
-import de.juplo.demos.consumer.domain.UserService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.RestTemplate;
-
-import java.util.Optional;
-import java.util.UUID;
-
-
-@RequiredArgsConstructor
-public class RemoteUserServiceConsumer implements UserService
-{
- private String uriTemplate;
- private RestTemplate restTemplate;
-
-
- @Override
- public Optional<User> getUser(UUID id) {
- ResponseEntity<UserDTO> response =
- restTemplate.getForEntity(uriTemplate, UserDTO.class, id);
- HttpStatus status = response.getStatusCode();
- UserDTO dto = response.getBody();
- switch (response.getStatusCode()) {
- case OK:
- return
- Optional.of(
- User.builder()
- .id(dto.id)
- .email(dto.email)
- .build());
- case NOT_FOUND:
- return Optional.empty();
- default:
- throw new RuntimeException(status.toString());
- }
- }
-}
+++ /dev/null
-package de.juplo.demos.consumer.adapter;
-
-import org.junit.jupiter.api.extension.ExtendWith;
-
-
-@ExtendWith(PactConsumerTestExt.class)
-@PactTestFor(providerName = "UsersProvider")
-public class RemoteUserServiceConsumerIT
-{
-
-}
--- /dev/null
+package de.juplo.demos.consumer.adapter;
+
+import de.juplo.demos.consumer.domain.User;
+import de.juplo.demos.consumer.domain.UserService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.Optional;
+import java.util.UUID;
+
+
+@RequiredArgsConstructor
+public class RemoteUsersServiceConsumer implements UserService
+{
+ private String uriTemplate;
+ private RestTemplate restTemplate;
+
+
+ @Override
+ public Optional<User> getUser(UUID id) {
+ ResponseEntity<UserDTO> response =
+ restTemplate.getForEntity(uriTemplate, UserDTO.class, id);
+ HttpStatus status = response.getStatusCode();
+ UserDTO dto = response.getBody();
+ switch (response.getStatusCode()) {
+ case OK:
+ return
+ Optional.of(
+ User.builder()
+ .id(dto.id)
+ .email(dto.email)
+ .build());
+ case NOT_FOUND:
+ return Optional.empty();
+ default:
+ throw new RuntimeException(status.toString());
+ }
+ }
+}
+++ /dev/null
-package de.juplo.demos.consumer.domain;
-
-import java.util.Optional;
-import java.util.UUID;
-
-
-public interface UserService
-{
- Optional<User> getUser(UUID id);
-}
--- /dev/null
+package de.juplo.demos.consumer.domain;
+
+import java.util.Optional;
+import java.util.UUID;
+
+
+public interface UserService
+{
+ Optional<User> getUser(UUID id);
+}
--- /dev/null
+package de.juplo.demos.consumer.adapter;
+
+import au.com.dius.pact.consumer.junit5.PactConsumerTestExt;
+import au.com.dius.pact.consumer.junit5.PactTestFor;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+
+@ExtendWith(PactConsumerTestExt.class)
+@PactTestFor(providerName = "UsersProvider")
+public class RemoteUsersServiceConsumerIT
+{
+
+}