diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..31354ec1389994b5f6708c7d915fdcc6bb76ba6e --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/borestop/.mvn/wrapper/MavenWrapperDownloader.java b/borestop/.mvn/wrapper/MavenWrapperDownloader.java index 5a155e2dc595beb7ae62f896bb83d2452cf209b9..2e4eb24b287462813ac2278502f1b0978b28283d 100644 --- a/borestop/.mvn/wrapper/MavenWrapperDownloader.java +++ b/borestop/.mvn/wrapper/MavenWrapperDownloader.java @@ -19,6 +19,7 @@ import java.nio.channels.*; import java.util.Properties; public class MavenWrapperDownloader { + private static final String WRAPPER_VERSION = "0.5.6"; /** @@ -97,7 +98,6 @@ public class MavenWrapperDownloader { char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); Authenticator.setDefault( new Authenticator() { - @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); diff --git a/borestop/src/main/java/com/ippon/borestop/BorestopApp.java b/borestop/src/main/java/com/ippon/borestop/BorestopApp.java index 0d42d5f7aeb3119eebcc7a1177ea0abac8c2186a..d78133d74ad1f00b8c0921db3208d68d3b05d78a 100644 --- a/borestop/src/main/java/com/ippon/borestop/BorestopApp.java +++ b/borestop/src/main/java/com/ippon/borestop/BorestopApp.java @@ -22,6 +22,7 @@ import org.springframework.core.env.Environment; @SpringBootApplication @EnableConfigurationProperties({ LiquibaseProperties.class, ApplicationProperties.class }) public class BorestopApp { + private static final Logger log = LoggerFactory.getLogger(BorestopApp.class); private final Environment env; diff --git a/borestop/src/main/java/com/ippon/borestop/activity/application/ActivitesApplicationService.java b/borestop/src/main/java/com/ippon/borestop/activity/application/ActivitesApplicationService.java index fc3f9149ba06104dde92814409bd2dbdd11b2089..8302679ebbe7b8d07d01cd0891477b59da0841a9 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/application/ActivitesApplicationService.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/application/ActivitesApplicationService.java @@ -8,6 +8,7 @@ import org.springframework.stereotype.Service; @Service public class ActivitesApplicationService { + private final ActivitiesFactory activities; public ActivitesApplicationService(IdeasRepository ideas, PartnersRepository partners) { diff --git a/borestop/src/main/java/com/ippon/borestop/activity/domain/Activities.java b/borestop/src/main/java/com/ippon/borestop/activity/domain/Activities.java index eeb451b8f4380f4f218882bf1556e2f3dcbe874e..9aae09c88d0ae1ee19e698837dba84d334d6c1d7 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/domain/Activities.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/domain/Activities.java @@ -1,6 +1,7 @@ package com.ippon.borestop.activity.domain; public class Activities { + private final IdeasRepository ideas; private final PartnersRepository partners; diff --git a/borestop/src/main/java/com/ippon/borestop/activity/domain/ActivitiesFactory.java b/borestop/src/main/java/com/ippon/borestop/activity/domain/ActivitiesFactory.java index c34c1ff50f462152aca8199bba58b55600196186..9eab35426ff7756cc0ec4442f8b73a21cfb0c0e7 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/domain/ActivitiesFactory.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/domain/ActivitiesFactory.java @@ -1,6 +1,7 @@ package com.ippon.borestop.activity.domain; public class ActivitiesFactory { + private final IdeasRepository ideas; private final PartnersRepository partners; diff --git a/borestop/src/main/java/com/ippon/borestop/activity/domain/Activity.java b/borestop/src/main/java/com/ippon/borestop/activity/domain/Activity.java index 5a1d4d6fdc04fd7f5139ec8d06786b5cecc6484b..116db8bce465963b4a554f771b0b273f0e5d5b3d 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/domain/Activity.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/domain/Activity.java @@ -4,6 +4,7 @@ import com.ippon.borestop.common.domain.error.Assert; import java.util.Collection; public class Activity { + private final Idea idea; private final Partners partners; diff --git a/borestop/src/main/java/com/ippon/borestop/activity/domain/Category.java b/borestop/src/main/java/com/ippon/borestop/activity/domain/Category.java index 48a9df3071f164db9d4cbabd1751259c8fe71b72..8edfd9fef9e8c6ab2a3017c15db9f438304c654d 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/domain/Category.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/domain/Category.java @@ -3,5 +3,5 @@ package com.ippon.borestop.activity.domain; public enum Category { COOKING, RELAXATION, - DEFAULT + DEFAULT, } diff --git a/borestop/src/main/java/com/ippon/borestop/activity/domain/Idea.java b/borestop/src/main/java/com/ippon/borestop/activity/domain/Idea.java index 3c2ba1d85cfb236cb24e33ac18f64cd9a1defe8d..f81bb00efa929263619ff3ef3166951d04d46f01 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/domain/Idea.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/domain/Idea.java @@ -3,6 +3,7 @@ package com.ippon.borestop.activity.domain; import com.ippon.borestop.common.domain.error.Assert; public class Idea { + private final String label; private final Category category; diff --git a/borestop/src/main/java/com/ippon/borestop/activity/domain/Partner.java b/borestop/src/main/java/com/ippon/borestop/activity/domain/Partner.java index 509fc49cb1ff1d2cd27738327f1e26c7556a17f0..4942361e0baa22995429b0287ea3214d131b4020 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/domain/Partner.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/domain/Partner.java @@ -3,6 +3,7 @@ package com.ippon.borestop.activity.domain; import com.ippon.borestop.common.domain.error.Assert; public class Partner { + private final String name; private final String website; @@ -27,6 +28,7 @@ public class Partner { } public static class PartnerBuilder { + private String name; private String website; diff --git a/borestop/src/main/java/com/ippon/borestop/activity/domain/Partners.java b/borestop/src/main/java/com/ippon/borestop/activity/domain/Partners.java index 7d1a7f69ff60148040605f2b58a4d6a05166176d..c1a5834eaf285a2f5fd9fcc146e511ea05439e3c 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/domain/Partners.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/domain/Partners.java @@ -6,6 +6,7 @@ import java.util.Collections; import java.util.List; public class Partners { + private final Collection<Partner> partners; private Partners(PartnersBuilder builder) { @@ -25,6 +26,7 @@ public class Partners { } public static class PartnersBuilder { + private final List<Partner> partners = new ArrayList<>(); public PartnersBuilder add(Partner partner) { diff --git a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/ActivitesResource.java b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/ActivitesResource.java index 9349398af55605fe568e820b1d3de6e3856ab271..71ea8a5864382e0487f8406f6bb95158272c0a8f 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/ActivitesResource.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/ActivitesResource.java @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController; @Api(tags = "Activities") @RequestMapping("/api/activity") class ActivitesResource { + private final ActivitesApplicationService activites; public ActivitesResource(ActivitesApplicationService activites) { diff --git a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/RestActivity.java b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/RestActivity.java index 8ca71e1d947cd54cc6a4d86925207a18caf2e530..81db1a0035a66cfd2a7df98d6358aa3f133e701b 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/RestActivity.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/RestActivity.java @@ -8,6 +8,7 @@ import java.util.stream.Collectors; @ApiModel(value = "Activity", description = "An ideal activity for you!") class RestActivity { + private final String label; private final Collection<RestPartner> partners; diff --git a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/RestPartner.java b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/RestPartner.java index 3f17f7d0dc0ee1f2e5e537c930dca1eb658fd0f5..acf46821fa0a42d520221ddfc332a6f62dc22fc2 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/RestPartner.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/primary/RestPartner.java @@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel; @ApiModel(value = "Partner", description = "Partner for an idea") class RestPartner { + private final String name; private final String website; diff --git a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiCategory.java b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiCategory.java index 231ff3ddbe573d1de82b93e84726c54eb77bf9a1..e813a8633f7fbadaab1d758579f7ce93384713e1 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiCategory.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiCategory.java @@ -11,6 +11,7 @@ enum BoredApiCategory { COOKING("cooking"), RELAXATION("relaxation"), DEFAULT("default"); + private static final Map<String, BoredApiCategory> categories = buildCategories(); private static Map<String, BoredApiCategory> buildCategories() { diff --git a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepository.java b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepository.java index d386bfbc828f06f3a1811cdd63d5f8898f2b0562..ea26dd302d53a20d264a9d0c244740572680080d 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepository.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepository.java @@ -10,6 +10,7 @@ import org.springframework.web.client.RestTemplate; @Service class BoredApiIdeasRepository implements IdeasRepository { + private final RestTemplate rest; private final String url; diff --git a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiProperties.java b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiProperties.java index 54313eb23d56370838dded39c9b222b04d268063..bdb39bfc9ed08725543ec0494a61ba540f1ef34e 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiProperties.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiProperties.java @@ -9,6 +9,7 @@ import org.springframework.validation.annotation.Validated; @Validated @ConfigurationProperties("bored-api") class BoredApiProperties { + private String url; private Duration connectTimeout; private Duration readTimeout; diff --git a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiResponse.java b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiResponse.java index a255c320591721277fd191b70286e20b005e5063..95b902ff56d2b8fd42117ab0985f7047f9fae62c 100644 --- a/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiResponse.java +++ b/borestop/src/main/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiResponse.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.ippon.borestop.activity.domain.Idea; class BoredApiResponse { + private final String activity; private final String type; diff --git a/borestop/src/main/java/com/ippon/borestop/aop/logging/LoggingAspect.java b/borestop/src/main/java/com/ippon/borestop/aop/logging/LoggingAspect.java index 6a3914ce6908739a8f08568a1863ad610e9e1f8e..8b13e5bd342e3dc74470fcbaf3f1d195be3810cf 100644 --- a/borestop/src/main/java/com/ippon/borestop/aop/logging/LoggingAspect.java +++ b/borestop/src/main/java/com/ippon/borestop/aop/logging/LoggingAspect.java @@ -22,6 +22,7 @@ import org.springframework.core.env.Profiles; @Aspect @Generated public class LoggingAspect { + private final Environment env; public LoggingAspect(Environment env) { diff --git a/borestop/src/main/java/com/ippon/borestop/common/domain/error/BorestopException.java b/borestop/src/main/java/com/ippon/borestop/common/domain/error/BorestopException.java index 26efd7fef02d6e5c2f8bef47064600c59b88cce8..6608795227a90912554469f57e904d0c9545fbd9 100644 --- a/borestop/src/main/java/com/ippon/borestop/common/domain/error/BorestopException.java +++ b/borestop/src/main/java/com/ippon/borestop/common/domain/error/BorestopException.java @@ -58,6 +58,7 @@ import java.util.Map; * </p> */ public class BorestopException extends RuntimeException { + private final Map<String, String> arguments; private final ErrorStatus status; private final BorestopMessage borestopMessage; @@ -126,6 +127,7 @@ public class BorestopException extends RuntimeException { } public static class BorestopExceptionBuilder { + private final Map<String, String> arguments = new HashMap<>(); private String message; private ErrorStatus status; diff --git a/borestop/src/main/java/com/ippon/borestop/common/domain/error/ErrorStatus.java b/borestop/src/main/java/com/ippon/borestop/common/domain/error/ErrorStatus.java index c8aefe82d08de49a1730b1bf89cd011541485486..613a06544c270898b3c3dd81bbba8ea282b94a9d 100644 --- a/borestop/src/main/java/com/ippon/borestop/common/domain/error/ErrorStatus.java +++ b/borestop/src/main/java/com/ippon/borestop/common/domain/error/ErrorStatus.java @@ -6,5 +6,5 @@ public enum ErrorStatus { FORBIDDEN, NOT_FOUND, CONFLICT, - INTERNAL_SERVER_ERROR + INTERNAL_SERVER_ERROR, } diff --git a/borestop/src/main/java/com/ippon/borestop/common/domain/error/StandardMessage.java b/borestop/src/main/java/com/ippon/borestop/common/domain/error/StandardMessage.java index 91093d586e1cfa466bac237c4b9be55c5ea2ffc9..883d74f80e2a4c8fb4c451acdd68bd48c32b878d 100644 --- a/borestop/src/main/java/com/ippon/borestop/common/domain/error/StandardMessage.java +++ b/borestop/src/main/java/com/ippon/borestop/common/domain/error/StandardMessage.java @@ -6,6 +6,7 @@ public enum StandardMessage implements BorestopMessage { INTERNAL_SERVER_ERROR("server.internal-server-error"), SERVER_MANDATORY_NULL("server.mandatory-null"), SERVER_MANDATORY_BLANK("server.mandatory-blank"); + private final String messageKey; private StandardMessage(String code) { diff --git a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/ArgumentsReplacer.java b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/ArgumentsReplacer.java index ca80b95912075a2260f78f81ca2a319d47dca0be..725017b0524ee7e95e7c6a2cedac4afe2a211fdb 100644 --- a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/ArgumentsReplacer.java +++ b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/ArgumentsReplacer.java @@ -3,6 +3,7 @@ package com.ippon.borestop.common.infrastructure.primary; import java.util.Map; final class ArgumentsReplacer { + private static final String OPEN_MUSTACHE = "\\{\\{\\s*"; private static final String CLOSE_MUSTACHE = "\\s*\\}\\}"; diff --git a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/AuthenticationMessage.java b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/AuthenticationMessage.java index 7bb80fa436574d1543dbf8f3705f92715e46919e..7429ec88b2f1d625c80061a3ab38960e1c834623 100644 --- a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/AuthenticationMessage.java +++ b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/AuthenticationMessage.java @@ -4,6 +4,7 @@ import com.ippon.borestop.common.domain.error.BorestopMessage; enum AuthenticationMessage implements BorestopMessage { NOT_AUTHENTICATED("user.authentication-not-authenticated"); + private final String messageKey; AuthenticationMessage(String messageKey) { diff --git a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopError.java b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopError.java index 9e4cd83ffaf2604aa3575145629a1ce8eea52f8a..da6bdf232614205e0702a8159c47c2d62e8a999d 100644 --- a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopError.java +++ b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopError.java @@ -11,6 +11,7 @@ import java.util.List; @ApiModel(description = "Error result for a WebService call") public class BorestopError { + @ApiModelProperty(value = "Technical type of this error", example = "user.mandatory", required = true) private final String errorType; diff --git a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandler.java b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandler.java index 805782657654a8a2ad951f73a99d253c2058f9d2..faf6446369602beae6e68ef387bef6a753bf2c5b 100644 --- a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandler.java +++ b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandler.java @@ -40,6 +40,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExcep @ControllerAdvice public class BorestopErrorHandler extends ResponseEntityExceptionHandler { + private static final String MESSAGE_PREFIX = "borestop.error."; private static final String DEFAULT_KEY = StandardMessage.INTERNAL_SERVER_ERROR.getMessageKey(); private static final String BAD_REQUEST_KEY = StandardMessage.BAD_REQUEST.getMessageKey(); diff --git a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopFieldError.java b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopFieldError.java index 7a771603523b4aeff3e3a549f887f13efefe3df1..3d75113849bb067a5ec5c5646a4a7ca16874728d 100644 --- a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopFieldError.java +++ b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/BorestopFieldError.java @@ -12,6 +12,7 @@ import io.swagger.annotations.ApiModelProperty; @JsonDeserialize(builder = BorestopFieldErrorBuilder.class) @ApiModel(description = "Error for a field validation") public class BorestopFieldError { + @ApiModelProperty(value = "Path to the field in error", example = "address.country", required = true) private final String fieldPath; @@ -45,6 +46,7 @@ public class BorestopFieldError { @JsonPOJOBuilder(withPrefix = "") public static class BorestopFieldErrorBuilder { + private String fieldPath; private String reason; private String message; diff --git a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/ValidationMessage.java b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/ValidationMessage.java index bd7eb0a4444f2b8e17dd4231633c8dd911a50f97..03d31e84dab163cef46495b9ab127ba7bcbb831e 100644 --- a/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/ValidationMessage.java +++ b/borestop/src/main/java/com/ippon/borestop/common/infrastructure/primary/ValidationMessage.java @@ -1,6 +1,7 @@ package com.ippon.borestop.common.infrastructure.primary; public final class ValidationMessage { + public static final String MANDATORY = "user.mandatory"; public static final String WRONG_FORMAT = "user.wrong-format"; public static final String RPPS_FORMAT = "user.wrong-national-id-format"; diff --git a/borestop/src/main/java/com/ippon/borestop/config/AsyncConfiguration.java b/borestop/src/main/java/com/ippon/borestop/config/AsyncConfiguration.java index 90ff4669adcbceff244402e369cff09eac8a4d56..8598bf17c6a8133b49e1e6b07c6fbaecc460ddfc 100644 --- a/borestop/src/main/java/com/ippon/borestop/config/AsyncConfiguration.java +++ b/borestop/src/main/java/com/ippon/borestop/config/AsyncConfiguration.java @@ -20,6 +20,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @Configuration @EnableScheduling public class AsyncConfiguration implements AsyncConfigurer { + private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class); private final TaskExecutionProperties taskExecutionProperties; diff --git a/borestop/src/main/java/com/ippon/borestop/config/AuthenticationErrorsHandler.java b/borestop/src/main/java/com/ippon/borestop/config/AuthenticationErrorsHandler.java index cc292bd99f18efaccce7a149ae850c93189e7c87..16cb2bcd50cca9e2407fbbd03ae7ce4da80c2d1a 100644 --- a/borestop/src/main/java/com/ippon/borestop/config/AuthenticationErrorsHandler.java +++ b/borestop/src/main/java/com/ippon/borestop/config/AuthenticationErrorsHandler.java @@ -17,6 +17,7 @@ import org.springframework.web.servlet.HandlerExceptionResolver; @Generated @Component class AuthenticationErrorsHandler implements AuthenticationEntryPoint, AccessDeniedHandler { + private final HandlerExceptionResolver resolver; @Autowired diff --git a/borestop/src/main/java/com/ippon/borestop/config/CloudDatabaseConfiguration.java b/borestop/src/main/java/com/ippon/borestop/config/CloudDatabaseConfiguration.java index 18ea1174fabe190d7aa4e985db18648b5820c037..e8875c5833028da4b4bb02a829606fa129f4ff65 100644 --- a/borestop/src/main/java/com/ippon/borestop/config/CloudDatabaseConfiguration.java +++ b/borestop/src/main/java/com/ippon/borestop/config/CloudDatabaseConfiguration.java @@ -13,6 +13,7 @@ import org.springframework.context.annotation.*; @Configuration @Profile(JHipsterConstants.SPRING_PROFILE_CLOUD) public class CloudDatabaseConfiguration extends AbstractCloudConfig { + private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class); private static final String CLOUD_CONFIGURATION_HIKARI_PREFIX = "spring.datasource.hikari"; diff --git a/borestop/src/main/java/com/ippon/borestop/config/Constants.java b/borestop/src/main/java/com/ippon/borestop/config/Constants.java index a650d3b2c0dd566b609b84133733782ed842e6e7..18e244d8d67e7732367a3c07128ee584018d554a 100644 --- a/borestop/src/main/java/com/ippon/borestop/config/Constants.java +++ b/borestop/src/main/java/com/ippon/borestop/config/Constants.java @@ -7,6 +7,7 @@ import com.ippon.borestop.common.infrastructure.Generated; */ @Generated public final class Constants { + // Regex for acceptable logins public static final String LOGIN_REGEX = "^(?>[a-zA-Z0-9!$&*+=?^_`{|}~.-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*)|(?>[_.@A-Za-z0-9-]+)$"; diff --git a/borestop/src/main/java/com/ippon/borestop/config/DatabaseConfiguration.java b/borestop/src/main/java/com/ippon/borestop/config/DatabaseConfiguration.java index 8b697e13b79f651caa2f2fa318b7073d11d943e2..5d816cc3cd04cf079b0af8da41a5c4ab41bb1b04 100644 --- a/borestop/src/main/java/com/ippon/borestop/config/DatabaseConfiguration.java +++ b/borestop/src/main/java/com/ippon/borestop/config/DatabaseConfiguration.java @@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware") @EnableTransactionManagement public class DatabaseConfiguration { + private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class); private final Environment env; diff --git a/borestop/src/main/java/com/ippon/borestop/config/LiquibaseConfiguration.java b/borestop/src/main/java/com/ippon/borestop/config/LiquibaseConfiguration.java index ac6be3fb05a52251ad1e287660e367b5f6a7ab56..f190ea89acce01560f7121698a65ae33b1f1d97f 100644 --- a/borestop/src/main/java/com/ippon/borestop/config/LiquibaseConfiguration.java +++ b/borestop/src/main/java/com/ippon/borestop/config/LiquibaseConfiguration.java @@ -21,6 +21,7 @@ import org.springframework.core.env.Profiles; @Generated @Configuration public class LiquibaseConfiguration { + private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class); private final Environment env; diff --git a/borestop/src/main/java/com/ippon/borestop/config/LoggingConfiguration.java b/borestop/src/main/java/com/ippon/borestop/config/LoggingConfiguration.java index 26b906d951530e412376e765a6943d2f3e8de917..5f54e5676559dee7a86d176ca0330d04ae00f54c 100644 --- a/borestop/src/main/java/com/ippon/borestop/config/LoggingConfiguration.java +++ b/borestop/src/main/java/com/ippon/borestop/config/LoggingConfiguration.java @@ -25,8 +25,7 @@ public class LoggingConfiguration { @Value("${server.port}") String serverPort, JHipsterProperties jHipsterProperties, ObjectMapper mapper - ) - throws JsonProcessingException { + ) throws JsonProcessingException { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); Map<String, String> map = new HashMap<>(); diff --git a/borestop/src/main/java/com/ippon/borestop/config/SecurityConfiguration.java b/borestop/src/main/java/com/ippon/borestop/config/SecurityConfiguration.java index 353cad7dfb073be93b7e05addea618cf9a4b342c..0e78c0c87e32cc193f4f44100ad9fd167f3c6228 100644 --- a/borestop/src/main/java/com/ippon/borestop/config/SecurityConfiguration.java +++ b/borestop/src/main/java/com/ippon/borestop/config/SecurityConfiguration.java @@ -26,6 +26,7 @@ import org.springframework.web.filter.CorsFilter; @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) public class SecurityConfiguration extends WebSecurityConfigurerAdapter { + private final TokenProvider tokenProvider; private final CorsFilter corsFilter; @@ -99,7 +100,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { .and() .securityContext() .securityContextRepository(securityContextRepository()); - // @formatter:on + // @formatter:on } @Bean diff --git a/borestop/src/main/java/com/ippon/borestop/config/StaticResourcesWebConfiguration.java b/borestop/src/main/java/com/ippon/borestop/config/StaticResourcesWebConfiguration.java index b508211f2064975beaa8c8a6fcafaa011f06265b..4817797a3beda5f3038e9cb2647f02bb48704350 100644 --- a/borestop/src/main/java/com/ippon/borestop/config/StaticResourcesWebConfiguration.java +++ b/borestop/src/main/java/com/ippon/borestop/config/StaticResourcesWebConfiguration.java @@ -15,10 +15,11 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration @Profile({ JHipsterConstants.SPRING_PROFILE_PRODUCTION }) public class StaticResourcesWebConfiguration implements WebMvcConfigurer { + protected static final String[] RESOURCE_LOCATIONS = new String[] { "classpath:/static/app/", "classpath:/static/content/", - "classpath:/static/i18n/" + "classpath:/static/i18n/", }; protected static final String[] RESOURCE_PATHS = new String[] { "/app/*", "/content/*", "/i18n/*" }; diff --git a/borestop/src/main/java/com/ippon/borestop/config/WebConfigurer.java b/borestop/src/main/java/com/ippon/borestop/config/WebConfigurer.java index e9f5b2a9dd7a8c2c1de978a844b2566a7fdb8696..baf15169e0ac50bf32e2a9ea63a03dd64bf76a8e 100644 --- a/borestop/src/main/java/com/ippon/borestop/config/WebConfigurer.java +++ b/borestop/src/main/java/com/ippon/borestop/config/WebConfigurer.java @@ -31,6 +31,7 @@ import org.springframework.web.filter.CorsFilter; @Generated @Configuration public class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { + private final Logger log = LoggerFactory.getLogger(WebConfigurer.class); private final Environment env; diff --git a/borestop/src/main/java/com/ippon/borestop/domain/AbstractAuditingEntity.java b/borestop/src/main/java/com/ippon/borestop/domain/AbstractAuditingEntity.java index 4a02f2d43ec6ca03b407acc07f143398610ee5a2..54b642172abed62274ce15d390045a10ae194b1e 100644 --- a/borestop/src/main/java/com/ippon/borestop/domain/AbstractAuditingEntity.java +++ b/borestop/src/main/java/com/ippon/borestop/domain/AbstractAuditingEntity.java @@ -21,6 +21,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; @MappedSuperclass @EntityListeners(AuditingEntityListener.class) public abstract class AbstractAuditingEntity implements Serializable { + private static final long serialVersionUID = 1L; @CreatedBy diff --git a/borestop/src/main/java/com/ippon/borestop/domain/Authority.java b/borestop/src/main/java/com/ippon/borestop/domain/Authority.java index 1b4ba6ee774ac9210891a01f4cb2d58085b7a07e..b1b7bdf500d8993347a50b7de57ab607b62d6a52 100644 --- a/borestop/src/main/java/com/ippon/borestop/domain/Authority.java +++ b/borestop/src/main/java/com/ippon/borestop/domain/Authority.java @@ -17,6 +17,7 @@ import javax.validation.constraints.Size; @Generated @Table(name = "jhi_authority") public class Authority implements Serializable { + private static final long serialVersionUID = 1L; @NotNull diff --git a/borestop/src/main/java/com/ippon/borestop/domain/PersistentAuditEvent.java b/borestop/src/main/java/com/ippon/borestop/domain/PersistentAuditEvent.java index b1f18fdd87472d351bbaa93a58dbf20b9941642b..aa7e46a4d28a2017412c9d37661c497c6215de21 100644 --- a/borestop/src/main/java/com/ippon/borestop/domain/PersistentAuditEvent.java +++ b/borestop/src/main/java/com/ippon/borestop/domain/PersistentAuditEvent.java @@ -17,6 +17,7 @@ import javax.validation.constraints.NotNull; @Generated @Table(name = "jhi_persistent_audit_event") public class PersistentAuditEvent implements Serializable { + private static final long serialVersionUID = 1L; @Id diff --git a/borestop/src/main/java/com/ippon/borestop/domain/User.java b/borestop/src/main/java/com/ippon/borestop/domain/User.java index d67c5336f2926d402f8f8950daf119c2df00aff7..8766b0f1410644dff275199dc103fc47b80ba9b2 100644 --- a/borestop/src/main/java/com/ippon/borestop/domain/User.java +++ b/borestop/src/main/java/com/ippon/borestop/domain/User.java @@ -23,6 +23,7 @@ import org.hibernate.annotations.BatchSize; @Generated @Table(name = "jhi_user") public class User extends AbstractAuditingEntity implements Serializable { + private static final long serialVersionUID = 1L; @Id diff --git a/borestop/src/main/java/com/ippon/borestop/repository/CustomAuditEventRepository.java b/borestop/src/main/java/com/ippon/borestop/repository/CustomAuditEventRepository.java index ab54b9747a917624a3152d75cae849eadfe2bbb2..0773ab61c43073c0273d6e2815a502832453fe06 100644 --- a/borestop/src/main/java/com/ippon/borestop/repository/CustomAuditEventRepository.java +++ b/borestop/src/main/java/com/ippon/borestop/repository/CustomAuditEventRepository.java @@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; @Generated @Repository public class CustomAuditEventRepository implements AuditEventRepository { + private static final String AUTHORIZATION_FAILURE = "AUTHORIZATION_FAILURE"; /** diff --git a/borestop/src/main/java/com/ippon/borestop/security/AuthoritiesConstants.java b/borestop/src/main/java/com/ippon/borestop/security/AuthoritiesConstants.java index f9b4acb3d75401234d30d7c53d9f52666f016397..51d9ca98f1c9088c7f625407d988e86bd87f2f28 100644 --- a/borestop/src/main/java/com/ippon/borestop/security/AuthoritiesConstants.java +++ b/borestop/src/main/java/com/ippon/borestop/security/AuthoritiesConstants.java @@ -7,6 +7,7 @@ import com.ippon.borestop.common.infrastructure.Generated; */ @Generated public final class AuthoritiesConstants { + public static final String ADMIN = "ROLE_ADMIN"; public static final String USER = "ROLE_USER"; diff --git a/borestop/src/main/java/com/ippon/borestop/security/DomainUserDetailsService.java b/borestop/src/main/java/com/ippon/borestop/security/DomainUserDetailsService.java index 1106db59e543ef6e9a38a78da2f7bc3fc2a4ddc8..968b7ac77a58dd7172ba7edefb4d58bb422f3f29 100644 --- a/borestop/src/main/java/com/ippon/borestop/security/DomainUserDetailsService.java +++ b/borestop/src/main/java/com/ippon/borestop/security/DomainUserDetailsService.java @@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional; @Generated @Component("userDetailsService") public class DomainUserDetailsService implements UserDetailsService { + private final Logger log = LoggerFactory.getLogger(DomainUserDetailsService.class); private final UserRepository userRepository; diff --git a/borestop/src/main/java/com/ippon/borestop/security/UserNotActivatedException.java b/borestop/src/main/java/com/ippon/borestop/security/UserNotActivatedException.java index 382398544d1471780c481140eca53636c164c13e..596a9c77b352bb54d195b2d5c57e2d70ab9bbd37 100644 --- a/borestop/src/main/java/com/ippon/borestop/security/UserNotActivatedException.java +++ b/borestop/src/main/java/com/ippon/borestop/security/UserNotActivatedException.java @@ -8,6 +8,7 @@ import org.springframework.security.core.AuthenticationException; */ @Generated public class UserNotActivatedException extends AuthenticationException { + private static final long serialVersionUID = 1L; public UserNotActivatedException(String message) { diff --git a/borestop/src/main/java/com/ippon/borestop/security/jwt/JWTConfigurer.java b/borestop/src/main/java/com/ippon/borestop/security/jwt/JWTConfigurer.java index 6ef786c787d7b13f82e12aae5da1b8122d3ec97c..9eb43d7fffebe1d11aa39fff2f434c45c14b61df 100644 --- a/borestop/src/main/java/com/ippon/borestop/security/jwt/JWTConfigurer.java +++ b/borestop/src/main/java/com/ippon/borestop/security/jwt/JWTConfigurer.java @@ -8,6 +8,7 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic @Generated public class JWTConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> { + private final TokenProvider tokenProvider; public JWTConfigurer(TokenProvider tokenProvider) { diff --git a/borestop/src/main/java/com/ippon/borestop/security/jwt/JWTFilter.java b/borestop/src/main/java/com/ippon/borestop/security/jwt/JWTFilter.java index 43d2ad81ba03c51297b3ff14e94d420d949fb45d..0c7c3b56fc4be40a2d040ed53b0d3bf638ce7e96 100644 --- a/borestop/src/main/java/com/ippon/borestop/security/jwt/JWTFilter.java +++ b/borestop/src/main/java/com/ippon/borestop/security/jwt/JWTFilter.java @@ -18,6 +18,7 @@ import org.springframework.web.filter.GenericFilterBean; */ @Generated public class JWTFilter extends GenericFilterBean { + public static final String AUTHORIZATION_HEADER = "Authorization"; private final TokenProvider tokenProvider; diff --git a/borestop/src/main/java/com/ippon/borestop/security/jwt/TokenProvider.java b/borestop/src/main/java/com/ippon/borestop/security/jwt/TokenProvider.java index fbc7b63c3ca8479bdf3633aa79fd4cebe18d478e..f2b3487869d2f920a98d4acb2752303392a0d8f3 100644 --- a/borestop/src/main/java/com/ippon/borestop/security/jwt/TokenProvider.java +++ b/borestop/src/main/java/com/ippon/borestop/security/jwt/TokenProvider.java @@ -23,6 +23,7 @@ import org.springframework.util.StringUtils; @Generated @Component public class TokenProvider { + private final Logger log = LoggerFactory.getLogger(TokenProvider.class); private static final String AUTHORITIES_KEY = "auth"; diff --git a/borestop/src/main/java/com/ippon/borestop/service/AuditEventService.java b/borestop/src/main/java/com/ippon/borestop/service/AuditEventService.java index a6a3a0da77153ddbeed5ebd50e9013b4b233b0a1..87a4d0a14215c87c7558b443dcd243a5f190fcab 100644 --- a/borestop/src/main/java/com/ippon/borestop/service/AuditEventService.java +++ b/borestop/src/main/java/com/ippon/borestop/service/AuditEventService.java @@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional; @Generated @Transactional public class AuditEventService { + private final Logger log = LoggerFactory.getLogger(AuditEventService.class); private final JHipsterProperties jHipsterProperties; diff --git a/borestop/src/main/java/com/ippon/borestop/service/EmailAlreadyUsedException.java b/borestop/src/main/java/com/ippon/borestop/service/EmailAlreadyUsedException.java index 3593d0ba71a36d6201ac87af6d586b9ba0bdeab2..2efd395511df28ea32628273661383e65885d665 100644 --- a/borestop/src/main/java/com/ippon/borestop/service/EmailAlreadyUsedException.java +++ b/borestop/src/main/java/com/ippon/borestop/service/EmailAlreadyUsedException.java @@ -6,6 +6,7 @@ import com.ippon.borestop.common.infrastructure.Generated; @Generated public class EmailAlreadyUsedException extends BorestopException { + private static final long serialVersionUID = 1L; public EmailAlreadyUsedException() { diff --git a/borestop/src/main/java/com/ippon/borestop/service/LoginAlreadyUsedException.java b/borestop/src/main/java/com/ippon/borestop/service/LoginAlreadyUsedException.java index 69cc20d379e6deec26ffe4e946aaf7ee26f03518..8f27334251616f67395b10a02836ef9b736f4b09 100644 --- a/borestop/src/main/java/com/ippon/borestop/service/LoginAlreadyUsedException.java +++ b/borestop/src/main/java/com/ippon/borestop/service/LoginAlreadyUsedException.java @@ -6,6 +6,7 @@ import com.ippon.borestop.common.infrastructure.Generated; @Generated public class LoginAlreadyUsedException extends BorestopException { + private static final long serialVersionUID = 1L; public LoginAlreadyUsedException() { diff --git a/borestop/src/main/java/com/ippon/borestop/service/MailService.java b/borestop/src/main/java/com/ippon/borestop/service/MailService.java index 0838eb51627819ad66cec4590e69a357447dd9f6..a102074d6671b697101d26028b406b81765c616e 100644 --- a/borestop/src/main/java/com/ippon/borestop/service/MailService.java +++ b/borestop/src/main/java/com/ippon/borestop/service/MailService.java @@ -26,6 +26,7 @@ import org.thymeleaf.spring5.SpringTemplateEngine; @Service @Generated public class MailService { + private final Logger log = LoggerFactory.getLogger(MailService.class); private static final String USER = "user"; diff --git a/borestop/src/main/java/com/ippon/borestop/service/UserMessage.java b/borestop/src/main/java/com/ippon/borestop/service/UserMessage.java index beadd404d5a5384664ab0e7bf13e3db0bb8f86b2..a3f1fac6be13dc0b92e8336654e65425c384330e 100644 --- a/borestop/src/main/java/com/ippon/borestop/service/UserMessage.java +++ b/borestop/src/main/java/com/ippon/borestop/service/UserMessage.java @@ -6,6 +6,7 @@ enum UserMessage implements BorestopMessage { EMAIL_ALREADY_USED("user.e-mail-already-used"), LOGIN_ALREADY_USED("user.login-already-used"), INVALID_PASSWORD("user.invalid-password"); + private final String messageKey; private UserMessage(String messageKey) { diff --git a/borestop/src/main/java/com/ippon/borestop/service/UserService.java b/borestop/src/main/java/com/ippon/borestop/service/UserService.java index 25d86dddd0b8dd5a0e7d01e77088e81351c692e6..00a3b6b4a556abc976e87c6da15528dab9c1eb0f 100644 --- a/borestop/src/main/java/com/ippon/borestop/service/UserService.java +++ b/borestop/src/main/java/com/ippon/borestop/service/UserService.java @@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional; @Generated @Transactional public class UserService { + private final Logger log = LoggerFactory.getLogger(UserService.class); private final UserRepository userRepository; diff --git a/borestop/src/main/java/com/ippon/borestop/service/dto/PasswordChangeDTO.java b/borestop/src/main/java/com/ippon/borestop/service/dto/PasswordChangeDTO.java index 1ff42cf235d54fa32766985ca2a951caec25e38a..56547f87ab1e8cd082b98c8d32596b3880c74052 100644 --- a/borestop/src/main/java/com/ippon/borestop/service/dto/PasswordChangeDTO.java +++ b/borestop/src/main/java/com/ippon/borestop/service/dto/PasswordChangeDTO.java @@ -7,6 +7,7 @@ import com.ippon.borestop.common.infrastructure.Generated; */ @Generated public class PasswordChangeDTO { + private String currentPassword; private String newPassword; diff --git a/borestop/src/main/java/com/ippon/borestop/service/dto/UserDTO.java b/borestop/src/main/java/com/ippon/borestop/service/dto/UserDTO.java index 51fd317297e3777fcfdca49500486c67c706a7b1..c6a6227cba4660f367e32b8e1278385767987134 100644 --- a/borestop/src/main/java/com/ippon/borestop/service/dto/UserDTO.java +++ b/borestop/src/main/java/com/ippon/borestop/service/dto/UserDTO.java @@ -14,6 +14,7 @@ import javax.validation.constraints.*; */ @Generated public class UserDTO { + private Long id; @NotBlank diff --git a/borestop/src/main/java/com/ippon/borestop/web/rest/AuditResource.java b/borestop/src/main/java/com/ippon/borestop/web/rest/AuditResource.java index 409cda744788c991910ce6f62f8b19c4103dc9bd..8f4bb161a7ec20a68bce9ef10586a1e505337e17 100644 --- a/borestop/src/main/java/com/ippon/borestop/web/rest/AuditResource.java +++ b/borestop/src/main/java/com/ippon/borestop/web/rest/AuditResource.java @@ -24,6 +24,7 @@ import org.springframework.web.servlet.support.ServletUriComponentsBuilder; @RestController @RequestMapping("/management/audits") public class AuditResource { + private final AuditEventService auditEventService; public AuditResource(AuditEventService auditEventService) { diff --git a/borestop/src/main/java/com/ippon/borestop/web/rest/UserJWTController.java b/borestop/src/main/java/com/ippon/borestop/web/rest/UserJWTController.java index 991878c81f8cdefead78b3856af77dca82fcbf4a..72ab91ae9753300f0932ba2435c687dc45385916 100644 --- a/borestop/src/main/java/com/ippon/borestop/web/rest/UserJWTController.java +++ b/borestop/src/main/java/com/ippon/borestop/web/rest/UserJWTController.java @@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api") public class UserJWTController { + private final TokenProvider tokenProvider; private final AuthenticationManagerBuilder authenticationManagerBuilder; @@ -52,6 +53,7 @@ public class UserJWTController { */ @Generated static class JWTToken { + private String idToken; JWTToken(String idToken) { diff --git a/borestop/src/main/java/com/ippon/borestop/web/rest/UserResource.java b/borestop/src/main/java/com/ippon/borestop/web/rest/UserResource.java index 5f053f1b7bd6bc385a0cbc404dcb81a033554010..38d0cc51eb36b3675f6ed02b445323c0f4f9d7fd 100644 --- a/borestop/src/main/java/com/ippon/borestop/web/rest/UserResource.java +++ b/borestop/src/main/java/com/ippon/borestop/web/rest/UserResource.java @@ -67,6 +67,7 @@ import org.springframework.web.servlet.support.ServletUriComponentsBuilder; @RestController @RequestMapping("/api") public class UserResource { + private final Logger log = LoggerFactory.getLogger(UserResource.class); @Value("${jhipster.clientApp.name}") diff --git a/borestop/src/main/java/com/ippon/borestop/web/rest/vm/KeyAndPasswordVM.java b/borestop/src/main/java/com/ippon/borestop/web/rest/vm/KeyAndPasswordVM.java index 7319127bb4d32611674726a1db6f9040f1fc9b9d..7ab1bd4265ca693aff3b4057ab2d1de0d092a7ce 100644 --- a/borestop/src/main/java/com/ippon/borestop/web/rest/vm/KeyAndPasswordVM.java +++ b/borestop/src/main/java/com/ippon/borestop/web/rest/vm/KeyAndPasswordVM.java @@ -7,6 +7,7 @@ import com.ippon.borestop.common.infrastructure.Generated; */ @Generated public class KeyAndPasswordVM { + private String key; private String newPassword; diff --git a/borestop/src/main/java/com/ippon/borestop/web/rest/vm/LoginVM.java b/borestop/src/main/java/com/ippon/borestop/web/rest/vm/LoginVM.java index 8c239fa2dd59f823f5925772e4b84b45a390f981..41eb3881bf083d8447cddc961f4fa8e3bb41f6d5 100644 --- a/borestop/src/main/java/com/ippon/borestop/web/rest/vm/LoginVM.java +++ b/borestop/src/main/java/com/ippon/borestop/web/rest/vm/LoginVM.java @@ -9,6 +9,7 @@ import javax.validation.constraints.Size; */ @Generated public class LoginVM { + @NotNull @Size(min = 1, max = 50) private String username; diff --git a/borestop/src/main/java/com/ippon/borestop/web/rest/vm/ManagedUserVM.java b/borestop/src/main/java/com/ippon/borestop/web/rest/vm/ManagedUserVM.java index 016bc929fcee07d3544e4edd21fe9b88618464f8..3b3f5bee106d1caab67eb194965af6f0b3c083b7 100644 --- a/borestop/src/main/java/com/ippon/borestop/web/rest/vm/ManagedUserVM.java +++ b/borestop/src/main/java/com/ippon/borestop/web/rest/vm/ManagedUserVM.java @@ -9,6 +9,7 @@ import javax.validation.constraints.Size; */ @Generated public class ManagedUserVM extends UserDTO { + public static final int PASSWORD_MIN_LENGTH = 4; public static final int PASSWORD_MAX_LENGTH = 100; diff --git a/borestop/src/test/java/com/ippon/borestop/activity/domain/ActivitiesUnitTest.java b/borestop/src/test/java/com/ippon/borestop/activity/domain/ActivitiesUnitTest.java index d2cae92bf53524eda3f13fcc01933eabeeb12733..40087a968ea5026498c009acbaf9de79b7c837bf 100644 --- a/borestop/src/test/java/com/ippon/borestop/activity/domain/ActivitiesUnitTest.java +++ b/borestop/src/test/java/com/ippon/borestop/activity/domain/ActivitiesUnitTest.java @@ -12,6 +12,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; @ExtendWith(SpringExtension.class) class ActivitiesUnitTest { + @Mock private IdeasRepository ideas; diff --git a/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/primary/ActivitiesStep.java b/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/primary/ActivitiesStep.java index 6813205a5105b79095911ab0027da5db377d105c..da3391d289c04d92feb53a775fae3503ee8a1456 100644 --- a/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/primary/ActivitiesStep.java +++ b/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/primary/ActivitiesStep.java @@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; public class ActivitiesStep { + @Autowired private TestRestTemplate rest; diff --git a/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepositoryCommunicationIntTest.java b/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepositoryCommunicationIntTest.java index 2349c07376309104c522dc93d80c8353407cec24..ebd5333c6e30f404982b97574b15645bb7861c63 100644 --- a/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepositoryCommunicationIntTest.java +++ b/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepositoryCommunicationIntTest.java @@ -14,6 +14,7 @@ import org.springframework.boot.web.server.LocalServerPort; @BorestopIntTest class BoredApiIdeasRepositoryCommunicationIntTest { + @LocalServerPort private int port; diff --git a/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepositoryIntTest.java b/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepositoryIntTest.java index 721370b16d026fd0de6aadde2ac33fec13375b9a..5de0934474186a6cb8f3eb4142da4a8760a26abd 100644 --- a/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepositoryIntTest.java +++ b/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiIdeasRepositoryIntTest.java @@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; @BorestopIntTest class BoredApiIdeasRepositoryIntTest { + @Autowired private IdeasRepository ideasRepository; diff --git a/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiResponseUnitTest.java b/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiResponseUnitTest.java index 08b9078594ba48b083096be5c141ebd097ef5663..0662160589e6edb5b14514063d9c92222a0cf6bf 100644 --- a/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiResponseUnitTest.java +++ b/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/BoredApiResponseUnitTest.java @@ -1,41 +1,43 @@ package com.ippon.borestop.activity.infrastructure.secondary; +import static org.assertj.core.api.Assertions.*; + import com.ippon.borestop.activity.domain.Category; import com.ippon.borestop.activity.domain.Idea; import com.ippon.borestop.common.infrastructure.primary.TestJson; import org.junit.jupiter.api.Test; -import static org.assertj.core.api.Assertions.*; - class BoredApiResponseUnitTest { - @Test - void shouldDeserializeFromJson() { - BoredApiResponse response = TestJson.readFromJson(json(), BoredApiResponse.class); - - assertThat(response.getActivity()).isEqualTo("Cook something together with someone"); - assertThat(response.getType()).isEqualTo("cooking"); - } - - @Test - void shouldConvertToDomain() { - BoredApiResponse response = new BoredApiResponse("activity", "cooking"); - - Idea idea = response.toDomain(); - - assertThat(idea.getLabel()).isEqualTo("activity"); - assertThat(idea.getCategory()).isEqualTo(Category.COOKING); - } - - private String json() { - return "{\n" + - " \"activity\": \"Cook something together with someone\",\n" + - " \"type\": \"cooking\",\n" + - " \"participants\": 2,\n" + - " \"price\": 0.3,\n" + - " \"link\": \"\",\n" + - " \"key\": \"1799120\",\n" + - " \"accessibility\": 0.8\n" + - "}"; - } + @Test + void shouldDeserializeFromJson() { + BoredApiResponse response = TestJson.readFromJson(json(), BoredApiResponse.class); + + assertThat(response.getActivity()).isEqualTo("Cook something together with someone"); + assertThat(response.getType()).isEqualTo("cooking"); + } + + @Test + void shouldConvertToDomain() { + BoredApiResponse response = new BoredApiResponse("activity", "cooking"); + + Idea idea = response.toDomain(); + + assertThat(idea.getLabel()).isEqualTo("activity"); + assertThat(idea.getCategory()).isEqualTo(Category.COOKING); + } + + private String json() { + return ( + "{\n" + + " \"activity\": \"Cook something together with someone\",\n" + + " \"type\": \"cooking\",\n" + + " \"participants\": 2,\n" + + " \"price\": 0.3,\n" + + " \"link\": \"\",\n" + + " \"key\": \"1799120\",\n" + + " \"accessibility\": 0.8\n" + + "}" + ); + } } diff --git a/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/FakeBoredApi.java b/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/FakeBoredApi.java index 8e22a06b7e1006596ac4765b89b70a8dd7e172c7..cca21b301de4505f095e3a064d43baab8132ee61 100644 --- a/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/FakeBoredApi.java +++ b/borestop/src/test/java/com/ippon/borestop/activity/infrastructure/secondary/FakeBoredApi.java @@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/fake-bored-api") class FakeBoredApi { + private boolean slow; void reset() { diff --git a/borestop/src/test/java/com/ippon/borestop/common/BorestopIntTest.java b/borestop/src/test/java/com/ippon/borestop/common/BorestopIntTest.java index 7590f5161aa46635e1a7e7b18048835d0568ddbb..3f147c539305d2c8f4ada2eceef7d291199dcd54 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/BorestopIntTest.java +++ b/borestop/src/test/java/com/ippon/borestop/common/BorestopIntTest.java @@ -2,14 +2,13 @@ package com.ippon.borestop.common; import com.ippon.borestop.BorestopApp; import io.github.jhipster.config.JHipsterConstants; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.test.context.ActiveProfiles; - import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.test.context.ActiveProfiles; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/borestop/src/test/java/com/ippon/borestop/common/LogSpy.java b/borestop/src/test/java/com/ippon/borestop/common/LogSpy.java index 8b0036f0886a18b949b8b96551bc0b00dd175d8f..59592e7fc6f9ea67f04c66d01cd5171b5c5c2dc4 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/LogSpy.java +++ b/borestop/src/test/java/com/ippon/borestop/common/LogSpy.java @@ -16,6 +16,7 @@ import org.junit.jupiter.api.extension.ParameterResolver; import org.slf4j.LoggerFactory; public final class LogSpy implements BeforeEachCallback, AfterEachCallback, ParameterResolver { + private Logger logger; private ListAppender<ILoggingEvent> appender; diff --git a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/AuthenticationSteps.java b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/AuthenticationSteps.java index 6602959f45b20e8e1c5df2a64c681a33ee75e54c..f25599bc082bf1ef21e52f3aa63bef01adb5b5fa 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/AuthenticationSteps.java +++ b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/AuthenticationSteps.java @@ -15,6 +15,7 @@ import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.context.SecurityContextHolder; public class AuthenticationSteps { + @Autowired private MockedSecurityContextRepository contexts; diff --git a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandlerIntTest.java b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandlerIntTest.java index 4a3578e3ddb0e465f9369688a18a5c9ea9381575..0499affb91c6158335da863ea27f5c9b12cba20d 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandlerIntTest.java +++ b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandlerIntTest.java @@ -21,6 +21,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; @BorestopIntTest class BorestopErrorHandlerIntTest { + private static final Charset UTF_8 = Charset.forName("UTF-8"); private static final String FRANCE_TAG = Locale.FRANCE.toLanguageTag(); diff --git a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandlerUnitTest.java b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandlerUnitTest.java index f116c7b8eeedc74b2561cc66f6ac26c8e9af3f45..41a8c7e126dda390d2f4e379b672ebacb58cd9f3 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandlerUnitTest.java +++ b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/BorestopErrorHandlerUnitTest.java @@ -30,6 +30,7 @@ import org.springframework.web.multipart.MaxUploadSizeExceededException; @ExtendWith({ SpringExtension.class, LogSpy.class }) class BorestopErrorHandlerUnitTest { + @Mock private MessageSource messages; diff --git a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ComplicatedRequest.java b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ComplicatedRequest.java index 407584cd2e6de34f0222f8bcdec65da4b562d5b6..9defa206e317b08d82bb49c919c7cffbeba1ec76 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ComplicatedRequest.java +++ b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ComplicatedRequest.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import javax.validation.constraints.Pattern; public class ComplicatedRequest { + private String value; public ComplicatedRequest(@JsonProperty("value") String value) { diff --git a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/CucumberTestContext.java b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/CucumberTestContext.java index 0da329ad5494eeb4096684767b6986c2675d4b04..773e01113709e264b46bddac93e32590d3b1b8d4 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/CucumberTestContext.java +++ b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/CucumberTestContext.java @@ -17,6 +17,7 @@ import org.springframework.http.client.ClientHttpResponse; import org.springframework.util.StreamUtils; public final class CucumberTestContext { + private static final Deque<RestQuery> queries = new ConcurrentLinkedDeque<>(); private static JsonProvider jsonReader = Configuration.defaultConfiguration().jsonProvider(); @@ -74,6 +75,7 @@ public final class CucumberTestContext { } private static class RestQuery { + private final String uri; private final HttpStatus status; private final Optional<String> response; diff --git a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ErrorMessagesUnitTest.java b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ErrorMessagesUnitTest.java index b87a690bc3649e2dc599e3ac1c9c9ad82a409406..68ea8b643434b75b49fd1037879dd7107895b6db 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ErrorMessagesUnitTest.java +++ b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ErrorMessagesUnitTest.java @@ -24,13 +24,14 @@ import org.reflections.util.ConfigurationBuilder; import org.reflections.util.FilterBuilder; public class ErrorMessagesUnitTest { + private static final Set<Class<? extends BorestopMessage>> errors = new Reflections( new ConfigurationBuilder() .setUrls(ClasspathHelper.forPackage("com.ippon")) .setScanners(new SubTypesScanner()) .filterInputsBy(new FilterBuilder().includePackage("com.ippon")) ) - .getSubTypesOf(BorestopMessage.class); + .getSubTypesOf(BorestopMessage.class); @Test public void shouldHaveOnlyEnumImplementations() { diff --git a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ErrorResource.java b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ErrorResource.java index c88e386096d640150a1f994baadd3a9c7217b054..ff8fc81c12cb1668d746e0ee87966594e1758a1c 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ErrorResource.java +++ b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/ErrorResource.java @@ -24,6 +24,7 @@ import org.springframework.web.server.ResponseStatusException; @RestController @RequestMapping("/errors") class ErrorResource { + private static final Logger logger = LoggerFactory.getLogger(ErrorResource.class); @GetMapping("/runtime-exceptions") diff --git a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/NotDeserializable.java b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/NotDeserializable.java index a37e4d323d443c74bf08d0251edcddfd0b429339..aacac380201a584626ae2da698d787e9d6fc332b 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/NotDeserializable.java +++ b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/NotDeserializable.java @@ -1,6 +1,7 @@ package com.ippon.borestop.common.infrastructure.primary; public class NotDeserializable { + private String value; public NotDeserializable(String value) { diff --git a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/QueryParameter.java b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/QueryParameter.java index b9411022035daa932d4db09cfa0c83b91eae2059..448f08a36c61d6ac1e78cd75144e50622183f1fe 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/QueryParameter.java +++ b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/QueryParameter.java @@ -4,6 +4,7 @@ import javax.validation.constraints.Max; import javax.validation.constraints.Min; class QueryParameter { + private int parameter; @Min(message = ValidationMessage.VALUE_TOO_LOW, value = 42) diff --git a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/TestJson.java b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/TestJson.java index 578d452737b63bb1802e93bd1e25ff26fa6f3932..2b1bc58af66d5bf76b1e6f2d13ad0f4ccafd5b4b 100644 --- a/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/TestJson.java +++ b/borestop/src/test/java/com/ippon/borestop/common/infrastructure/primary/TestJson.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import java.io.IOException; public final class TestJson { + private static final ObjectMapper jsonMapper = jsonMapper(); private TestJson() {} diff --git a/borestop/src/test/java/com/ippon/borestop/config/NoOpMailConfiguration.java b/borestop/src/test/java/com/ippon/borestop/config/NoOpMailConfiguration.java index bfec6ca7a98d00f69bdf4e971279132de0642412..320586ef15c1b596c4a7427fc4694ea746b331d5 100644 --- a/borestop/src/test/java/com/ippon/borestop/config/NoOpMailConfiguration.java +++ b/borestop/src/test/java/com/ippon/borestop/config/NoOpMailConfiguration.java @@ -10,6 +10,7 @@ import org.springframework.context.annotation.Configuration; @Configuration public class NoOpMailConfiguration { + private final MailService mockMailService; public NoOpMailConfiguration() { diff --git a/borestop/src/test/java/com/ippon/borestop/config/StaticResourcesWebConfigurerTest.java b/borestop/src/test/java/com/ippon/borestop/config/StaticResourcesWebConfigurerTest.java index 959eb67137ba14f38a8dc7b69478dbcee338b5d7..9e547376be431cfad6cd2d30667db31b502a52e9 100644 --- a/borestop/src/test/java/com/ippon/borestop/config/StaticResourcesWebConfigurerTest.java +++ b/borestop/src/test/java/com/ippon/borestop/config/StaticResourcesWebConfigurerTest.java @@ -16,6 +16,7 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistra import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; public class StaticResourcesWebConfigurerTest { + public static final int MAX_AGE_TEST = 5; public StaticResourcesWebConfiguration staticResourcesWebConfiguration; private ResourceHandlerRegistry resourceHandlerRegistry; diff --git a/borestop/src/test/java/com/ippon/borestop/config/WebConfigurerTest.java b/borestop/src/test/java/com/ippon/borestop/config/WebConfigurerTest.java index db55e12e409feed80733f638b2ce735988cf6955..7e4ce752c2f1f094a135d5228e05d915db2256ae 100644 --- a/borestop/src/test/java/com/ippon/borestop/config/WebConfigurerTest.java +++ b/borestop/src/test/java/com/ippon/borestop/config/WebConfigurerTest.java @@ -28,6 +28,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; * Unit tests for the {@link WebConfigurer} class. */ public class WebConfigurerTest { + private WebConfigurer webConfigurer; private MockServletContext servletContext; diff --git a/borestop/src/test/java/com/ippon/borestop/config/timezone/HibernateTimeZoneIT.java b/borestop/src/test/java/com/ippon/borestop/config/timezone/HibernateTimeZoneIT.java index c1a9932729e1b7bcf350e5df6d88197cd965a27e..db33e0b9112ce00696915bc3e6f940265a65348d 100644 --- a/borestop/src/test/java/com/ippon/borestop/config/timezone/HibernateTimeZoneIT.java +++ b/borestop/src/test/java/com/ippon/borestop/config/timezone/HibernateTimeZoneIT.java @@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional; */ @SpringBootTest(classes = BorestopApp.class) public class HibernateTimeZoneIT { + @Autowired private DateTimeWrapperRepository dateTimeWrapperRepository; diff --git a/borestop/src/test/java/com/ippon/borestop/cucumber/CucumberConfiguration.java b/borestop/src/test/java/com/ippon/borestop/cucumber/CucumberConfiguration.java index a1b4e9e588a830a2a96eccd847b7e70598fc788d..48348ad2b18a6419b9f526d09d0e69e22bdef88d 100644 --- a/borestop/src/test/java/com/ippon/borestop/cucumber/CucumberConfiguration.java +++ b/borestop/src/test/java/com/ippon/borestop/cucumber/CucumberConfiguration.java @@ -39,6 +39,7 @@ import org.springframework.web.client.RestTemplate; webEnvironment = WebEnvironment.RANDOM_PORT ) public class CucumberConfiguration { + @Autowired private TestRestTemplate rest; diff --git a/borestop/src/test/java/com/ippon/borestop/cucumber/MockedCsrfTokenRepository.java b/borestop/src/test/java/com/ippon/borestop/cucumber/MockedCsrfTokenRepository.java index 12de4b68bbecf035030b0b2d78114a454f4d9d2c..d62ecddb744971d937d5062f90ffb6dae76f0978 100644 --- a/borestop/src/test/java/com/ippon/borestop/cucumber/MockedCsrfTokenRepository.java +++ b/borestop/src/test/java/com/ippon/borestop/cucumber/MockedCsrfTokenRepository.java @@ -8,6 +8,7 @@ import org.springframework.security.web.csrf.CsrfToken; import org.springframework.security.web.csrf.CsrfTokenRepository; public class MockedCsrfTokenRepository implements CsrfTokenRepository { + private static final CsrfToken TOKEN = buildCsrfToken(); private static CsrfToken buildCsrfToken() { diff --git a/borestop/src/test/java/com/ippon/borestop/cucumber/MockedSecurityContextRepository.java b/borestop/src/test/java/com/ippon/borestop/cucumber/MockedSecurityContextRepository.java index 6454a5613dd68ea7163c26f9729a4194059ebe75..7fd9a4bb67a83b104923714a8ccfccde5cc5c639 100644 --- a/borestop/src/test/java/com/ippon/borestop/cucumber/MockedSecurityContextRepository.java +++ b/borestop/src/test/java/com/ippon/borestop/cucumber/MockedSecurityContextRepository.java @@ -9,6 +9,7 @@ import org.springframework.security.web.context.HttpRequestResponseHolder; import org.springframework.security.web.context.SecurityContextRepository; public class MockedSecurityContextRepository implements SecurityContextRepository { + private Authentication authentication; public void authentication(Authentication authentication) { diff --git a/borestop/src/test/java/com/ippon/borestop/repository/CustomAuditEventRepositoryIT.java b/borestop/src/test/java/com/ippon/borestop/repository/CustomAuditEventRepositoryIT.java index 22d84fe994995b3c9e2a6d2ab0bdbdfbe3922015..3462d3be8c83d02443253ce87988e8e9f71a5c2e 100644 --- a/borestop/src/test/java/com/ippon/borestop/repository/CustomAuditEventRepositoryIT.java +++ b/borestop/src/test/java/com/ippon/borestop/repository/CustomAuditEventRepositoryIT.java @@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional; @SpringBootTest(classes = BorestopApp.class) @Transactional public class CustomAuditEventRepositoryIT { + @Autowired private PersistenceAuditEventRepository persistenceAuditEventRepository; diff --git a/borestop/src/test/java/com/ippon/borestop/repository/timezone/DateTimeWrapper.java b/borestop/src/test/java/com/ippon/borestop/repository/timezone/DateTimeWrapper.java index 625d95d307ef08d8597cd329e58c5956f86e1371..c6683e72416353d44cd5037c36f632bae3eeef8c 100644 --- a/borestop/src/test/java/com/ippon/borestop/repository/timezone/DateTimeWrapper.java +++ b/borestop/src/test/java/com/ippon/borestop/repository/timezone/DateTimeWrapper.java @@ -8,6 +8,7 @@ import javax.persistence.*; @Entity @Table(name = "jhi_date_time_wrapper") public class DateTimeWrapper implements Serializable { + private static final long serialVersionUID = 1L; @Id diff --git a/borestop/src/test/java/com/ippon/borestop/security/DomainUserDetailsServiceIT.java b/borestop/src/test/java/com/ippon/borestop/security/DomainUserDetailsServiceIT.java index c922548b35063f9d038b68acd933eb967889511b..1cb6da9d1b9fe3a30b2f4999f93aafe3ec25f13c 100644 --- a/borestop/src/test/java/com/ippon/borestop/security/DomainUserDetailsServiceIT.java +++ b/borestop/src/test/java/com/ippon/borestop/security/DomainUserDetailsServiceIT.java @@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional; @SpringBootTest(classes = BorestopApp.class) @Transactional public class DomainUserDetailsServiceIT { + private static final String USER_ONE_LOGIN = "test-user-one"; private static final String USER_ONE_EMAIL = "test-user-one@localhost"; private static final String USER_TWO_LOGIN = "test-user-two"; diff --git a/borestop/src/test/java/com/ippon/borestop/security/jwt/JWTFilterTest.java b/borestop/src/test/java/com/ippon/borestop/security/jwt/JWTFilterTest.java index 1ea6d0153dc7f786129acf762f1670ca9d510d05..b818ae7ad91315d6be61709fccb240227952a62c 100644 --- a/borestop/src/test/java/com/ippon/borestop/security/jwt/JWTFilterTest.java +++ b/borestop/src/test/java/com/ippon/borestop/security/jwt/JWTFilterTest.java @@ -19,6 +19,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.test.util.ReflectionTestUtils; public class JWTFilterTest { + private TokenProvider tokenProvider; private JWTFilter jwtFilter; diff --git a/borestop/src/test/java/com/ippon/borestop/security/jwt/TokenProviderTest.java b/borestop/src/test/java/com/ippon/borestop/security/jwt/TokenProviderTest.java index 72c5e1d38ecd49d2d5240b421d340a71dc8158bb..592a7a8de7b44cf12f0da654ddc838f1f5d772ff 100644 --- a/borestop/src/test/java/com/ippon/borestop/security/jwt/TokenProviderTest.java +++ b/borestop/src/test/java/com/ippon/borestop/security/jwt/TokenProviderTest.java @@ -19,6 +19,7 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.test.util.ReflectionTestUtils; public class TokenProviderTest { + private static final long ONE_MINUTE = 60000; private Key key; diff --git a/borestop/src/test/java/com/ippon/borestop/service/AuditEventServiceIT.java b/borestop/src/test/java/com/ippon/borestop/service/AuditEventServiceIT.java index 984cd63b798370e6776d0a2b68ad65188df68b77..618b820f24286f014841acb092ebfdcb2d718cdf 100644 --- a/borestop/src/test/java/com/ippon/borestop/service/AuditEventServiceIT.java +++ b/borestop/src/test/java/com/ippon/borestop/service/AuditEventServiceIT.java @@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; @SpringBootTest(classes = BorestopApp.class) @Transactional public class AuditEventServiceIT { + @Autowired private AuditEventService auditEventService; diff --git a/borestop/src/test/java/com/ippon/borestop/service/MailServiceIT.java b/borestop/src/test/java/com/ippon/borestop/service/MailServiceIT.java index f48d512937fcce0b03b9ab1615187a5d16763d1f..9324e938c62a5650eb1c45c6b5a2b9bc100962a4 100644 --- a/borestop/src/test/java/com/ippon/borestop/service/MailServiceIT.java +++ b/borestop/src/test/java/com/ippon/borestop/service/MailServiceIT.java @@ -34,6 +34,7 @@ import org.thymeleaf.spring5.SpringTemplateEngine; */ @SpringBootTest(classes = BorestopApp.class) public class MailServiceIT { + @Autowired private JHipsterProperties jHipsterProperties; diff --git a/borestop/src/test/java/com/ippon/borestop/service/UserServiceIT.java b/borestop/src/test/java/com/ippon/borestop/service/UserServiceIT.java index 8d5c83d38c831bbbc3dc7fc951f0f566fc0faa16..142f3df1c28e6d99a5fde327c7136a04f07d57ff 100644 --- a/borestop/src/test/java/com/ippon/borestop/service/UserServiceIT.java +++ b/borestop/src/test/java/com/ippon/borestop/service/UserServiceIT.java @@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional; @SpringBootTest(classes = BorestopApp.class) @Transactional public class UserServiceIT { + private static final String DEFAULT_LOGIN = "johndoe"; private static final String DEFAULT_EMAIL = "johndoe@localhost"; diff --git a/borestop/src/test/java/com/ippon/borestop/service/mapper/UserMapperTest.java b/borestop/src/test/java/com/ippon/borestop/service/mapper/UserMapperTest.java index 172ef840b744d87b13fb37013fb822f396b5bb27..9fdfb987dcc6c8b2a49c251ec42e754ebe80cd32 100644 --- a/borestop/src/test/java/com/ippon/borestop/service/mapper/UserMapperTest.java +++ b/borestop/src/test/java/com/ippon/borestop/service/mapper/UserMapperTest.java @@ -16,6 +16,7 @@ import org.junit.jupiter.api.Test; * Unit tests for {@link UserMapper}. */ public class UserMapperTest { + private static final String DEFAULT_LOGIN = "johndoe"; private static final Long DEFAULT_ID = 1L; diff --git a/borestop/src/test/java/com/ippon/borestop/web/rest/AccountResourceIT.java b/borestop/src/test/java/com/ippon/borestop/web/rest/AccountResourceIT.java index b90d5d2e0889f53d5fb4972aa72017341d25279f..93067fd38fbf96912a19fac5cc473286710d7dc2 100644 --- a/borestop/src/test/java/com/ippon/borestop/web/rest/AccountResourceIT.java +++ b/borestop/src/test/java/com/ippon/borestop/web/rest/AccountResourceIT.java @@ -44,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional; @WithMockUser(value = AccountResourceIT.TEST_USER_LOGIN) @SpringBootTest(classes = BorestopApp.class) public class AccountResourceIT { + static final String TEST_USER_LOGIN = "test"; @Autowired diff --git a/borestop/src/test/java/com/ippon/borestop/web/rest/AccountsSteps.java b/borestop/src/test/java/com/ippon/borestop/web/rest/AccountsSteps.java index 59404234610a7bac3ebb50c9ac85fd6f9a33860f..700340721656eb339714035db32863d02a63d75a 100644 --- a/borestop/src/test/java/com/ippon/borestop/web/rest/AccountsSteps.java +++ b/borestop/src/test/java/com/ippon/borestop/web/rest/AccountsSteps.java @@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; public class AccountsSteps { + @Autowired private TestRestTemplate rest; diff --git a/borestop/src/test/java/com/ippon/borestop/web/rest/AuditResourceIT.java b/borestop/src/test/java/com/ippon/borestop/web/rest/AuditResourceIT.java index 2798105452fb854f98cf8e34678bd969d68f3890..e908dc760e125b10941572e0c2c3a12639b5049e 100644 --- a/borestop/src/test/java/com/ippon/borestop/web/rest/AuditResourceIT.java +++ b/borestop/src/test/java/com/ippon/borestop/web/rest/AuditResourceIT.java @@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional; @SpringBootTest(classes = BorestopApp.class) @Transactional public class AuditResourceIT { + private static final String SAMPLE_PRINCIPAL = "SAMPLE_PRINCIPAL"; private static final String SAMPLE_TYPE = "SAMPLE_TYPE"; private static final Instant SAMPLE_TIMESTAMP = Instant.parse("2015-08-04T10:11:30Z"); diff --git a/borestop/src/test/java/com/ippon/borestop/web/rest/ClientForwardControllerTest.java b/borestop/src/test/java/com/ippon/borestop/web/rest/ClientForwardControllerTest.java index d27571d218648139d71999752077adf0e857bf70..36063917d04eb3479ec4241bf8b2f8d98a221f04 100644 --- a/borestop/src/test/java/com/ippon/borestop/web/rest/ClientForwardControllerTest.java +++ b/borestop/src/test/java/com/ippon/borestop/web/rest/ClientForwardControllerTest.java @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController; * Unit tests for the {@link ClientForwardController} REST controller. */ public class ClientForwardControllerTest { + private MockMvc restMockMvc; @BeforeEach diff --git a/borestop/src/test/java/com/ippon/borestop/web/rest/TestUtil.java b/borestop/src/test/java/com/ippon/borestop/web/rest/TestUtil.java index da4ba50532e620022223f92389c9df9ce8c09223..0e4a85d694e6417299eb9d713221f4dc02cb47cd 100644 --- a/borestop/src/test/java/com/ippon/borestop/web/rest/TestUtil.java +++ b/borestop/src/test/java/com/ippon/borestop/web/rest/TestUtil.java @@ -25,6 +25,7 @@ import org.springframework.format.support.FormattingConversionService; * Utility class for testing REST controllers. */ public final class TestUtil { + private static final ObjectMapper mapper = createObjectMapper(); private static ObjectMapper createObjectMapper() { @@ -65,6 +66,7 @@ public final class TestUtil { * A matcher that tests that the examined string represents the same instant as the reference datetime. */ public static class ZonedDateTimeMatcher extends TypeSafeDiagnosingMatcher<String> { + private final ZonedDateTime date; public ZonedDateTimeMatcher(ZonedDateTime date) { diff --git a/borestop/src/test/java/com/ippon/borestop/web/rest/UserJWTControllerIT.java b/borestop/src/test/java/com/ippon/borestop/web/rest/UserJWTControllerIT.java index a62dec6b82019519e8757aa9b28ad5014112c524..19246cac8e660deadf89914cfe9654b0afa4452f 100644 --- a/borestop/src/test/java/com/ippon/borestop/web/rest/UserJWTControllerIT.java +++ b/borestop/src/test/java/com/ippon/borestop/web/rest/UserJWTControllerIT.java @@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional; @AutoConfigureMockMvc @SpringBootTest(classes = BorestopApp.class) public class UserJWTControllerIT { + @Autowired private UserRepository userRepository; diff --git a/borestop/src/test/java/com/ippon/borestop/web/rest/UserResourceIT.java b/borestop/src/test/java/com/ippon/borestop/web/rest/UserResourceIT.java index 53f246aedc66a89f9102c39883c401f14660169e..89669d7f8061fea134db2f0cef05708a30c56f4c 100644 --- a/borestop/src/test/java/com/ippon/borestop/web/rest/UserResourceIT.java +++ b/borestop/src/test/java/com/ippon/borestop/web/rest/UserResourceIT.java @@ -36,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional; @WithMockUser(authorities = AuthoritiesConstants.ADMIN) @SpringBootTest(classes = BorestopApp.class) public class UserResourceIT { + private static final String DEFAULT_LOGIN = "johndoe"; private static final String UPDATED_LOGIN = "jhipster"; diff --git a/bowling-game/src/main/java/fr/craft/kata/Game.java b/bowling-game/src/main/java/fr/craft/kata/Game.java index f0836a7b6bce9ea2216e06f6aa3f60165d5f8889..d12e625e04e3fc27535ee531ac96fdbf1a89b4a3 100644 --- a/bowling-game/src/main/java/fr/craft/kata/Game.java +++ b/bowling-game/src/main/java/fr/craft/kata/Game.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; public class Game { + private final List<Integer> rolls = new ArrayList<>(); public void roll(int pinsDown) { diff --git a/bowling-game/src/test/java/fr/craft/kata/GameTest.java b/bowling-game/src/test/java/fr/craft/kata/GameTest.java index fa38e4fffef62471fca7afdc93e55cd77e52fdd1..49a25983ef17a3503a650258d7850dc22126e8fc 100644 --- a/bowling-game/src/test/java/fr/craft/kata/GameTest.java +++ b/bowling-game/src/test/java/fr/craft/kata/GameTest.java @@ -5,6 +5,7 @@ import static org.assertj.core.api.Assertions.*; import org.junit.jupiter.api.Test; class GameTest { + private final Game game = new Game(); @Test diff --git a/employee-report/src/main/java/fr/ippon/employee/Employee.java b/employee-report/src/main/java/fr/ippon/employee/Employee.java index 4808ecdb0c751f40514886a2faa9231195b04ab0..410e4e20a233662e46855589dfb631b3b6244b36 100644 --- a/employee-report/src/main/java/fr/ippon/employee/Employee.java +++ b/employee-report/src/main/java/fr/ippon/employee/Employee.java @@ -1,6 +1,7 @@ package fr.ippon.employee; public class Employee { + private final String name; private final int age; diff --git a/employee-report/src/main/java/fr/ippon/employee/EmployeeReport.java b/employee-report/src/main/java/fr/ippon/employee/EmployeeReport.java index 798d35a0ddfacff0536f822e8faca4aa7187a930..f7714c89e945cfb08eaf9d92feee0dde2b1c927a 100644 --- a/employee-report/src/main/java/fr/ippon/employee/EmployeeReport.java +++ b/employee-report/src/main/java/fr/ippon/employee/EmployeeReport.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.stream.Collectors; public class EmployeeReport { + private final List<Employee> employees; public EmployeeReport(Employee... employees) { diff --git a/employee-report/src/test/java/fr/ippon/employee/EmployeeReportTest.java b/employee-report/src/test/java/fr/ippon/employee/EmployeeReportTest.java index 21053846712cfc00f91bfa2461653279ab35ad1a..d276c75b59f61e36333fa4961010b7c1a1e3b8e7 100644 --- a/employee-report/src/test/java/fr/ippon/employee/EmployeeReportTest.java +++ b/employee-report/src/test/java/fr/ippon/employee/EmployeeReportTest.java @@ -5,6 +5,7 @@ import static org.assertj.core.api.Assertions.*; import org.junit.jupiter.api.Test; public class EmployeeReportTest { + private static final EmployeeReport employees = buildEmployees(); private static EmployeeReport buildEmployees() { diff --git a/factory-patterns/src/main/java/fr/ippon/factory/Firstname.java b/factory-patterns/src/main/java/fr/ippon/factory/Firstname.java index ed7c1654c7ca6d98611881512fa1a4cbc5665295..942062599b0120098cd9fe82ccc297f8a348ef70 100644 --- a/factory-patterns/src/main/java/fr/ippon/factory/Firstname.java +++ b/factory-patterns/src/main/java/fr/ippon/factory/Firstname.java @@ -3,6 +3,7 @@ package fr.ippon.factory; import java.util.Optional; public class Firstname { + private final String firstname; public Firstname(String firstname) { diff --git a/factory-patterns/src/main/java/fr/ippon/factory/Lastname.java b/factory-patterns/src/main/java/fr/ippon/factory/Lastname.java index b5fc20ef01a132a9903daa1ac01d19ef2ef38df2..77eb066d14113a2707d891926312c3aa0021ece2 100644 --- a/factory-patterns/src/main/java/fr/ippon/factory/Lastname.java +++ b/factory-patterns/src/main/java/fr/ippon/factory/Lastname.java @@ -1,6 +1,7 @@ package fr.ippon.factory; public class Lastname { + private final String lastname; public Lastname(String lastname) { diff --git a/factory-patterns/src/main/java/fr/ippon/factory/Person.java b/factory-patterns/src/main/java/fr/ippon/factory/Person.java index 77c9854759e1f16e9ee7fd07d588b8da298bbee5..c28f08ad778082eae21bc50fdc1204bccf4e69db 100644 --- a/factory-patterns/src/main/java/fr/ippon/factory/Person.java +++ b/factory-patterns/src/main/java/fr/ippon/factory/Person.java @@ -1,6 +1,7 @@ package fr.ippon.factory; public class Person { + private final Firstname firstname; private final Lastname lastname; @@ -22,6 +23,7 @@ public class Person { } public static class PersonBuilder { + private String firstname; private String lastname; diff --git a/fizz-buzz/src/main/java/fr/ippon/fizzbuzz/FizzBuzz.java b/fizz-buzz/src/main/java/fr/ippon/fizzbuzz/FizzBuzz.java index 3f13d739810a75ae15da9e8fe02aad4aee25974f..ad39d893e120b7c11a371adda02110b4bf1edc5c 100644 --- a/fizz-buzz/src/main/java/fr/ippon/fizzbuzz/FizzBuzz.java +++ b/fizz-buzz/src/main/java/fr/ippon/fizzbuzz/FizzBuzz.java @@ -1,6 +1,7 @@ package fr.ippon.fizzbuzz; public class FizzBuzz { + private static final int BUZZ_VALUE = 5; private static final int FIZZ_VALUE = 3; diff --git a/game-of-life/src/main/java/fr/ippon/life/Cell.java b/game-of-life/src/main/java/fr/ippon/life/Cell.java index 9fdfad94dcb31603cccf8a9966b84b631bb27dd7..b8cff6adc6a5d5da330de97001da6ebc35b5b025 100644 --- a/game-of-life/src/main/java/fr/ippon/life/Cell.java +++ b/game-of-life/src/main/java/fr/ippon/life/Cell.java @@ -3,6 +3,7 @@ package fr.ippon.life; import java.util.Set; public class Cell { + private static final int LOW_POPULATION_THRESHOLD = 2; private static final int HIGH_POPULATION_THRESHOLD = 3; private static final int BORN_THRESHOLD = HIGH_POPULATION_THRESHOLD; diff --git a/game-of-life/src/main/java/fr/ippon/life/Generation.java b/game-of-life/src/main/java/fr/ippon/life/Generation.java index d314bfe5a61fb9f15463eb946e778c4daf648836..f5f28686c8a5c30538a62720439c71a50546a82c 100644 --- a/game-of-life/src/main/java/fr/ippon/life/Generation.java +++ b/game-of-life/src/main/java/fr/ippon/life/Generation.java @@ -6,6 +6,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; public class Generation { + private Set<Cell> aliveCells; public Generation(Cell... aliveCells) { diff --git a/game-of-life/src/main/java/fr/ippon/life/Grid.java b/game-of-life/src/main/java/fr/ippon/life/Grid.java index fc8669051f36881b7c7c3c29587a64a124c8e74f..aef8aa67c7462469a87d0f01fd7834c6d47f9010 100644 --- a/game-of-life/src/main/java/fr/ippon/life/Grid.java +++ b/game-of-life/src/main/java/fr/ippon/life/Grid.java @@ -7,6 +7,7 @@ import java.util.stream.IntStream; import java.util.stream.Stream; public class Grid { + private final Set<Cell> deadCells; private final Box box; @@ -35,6 +36,7 @@ public class Grid { } private static class Box { + private final Point topLeft; private final Point bottomRight; @@ -61,6 +63,7 @@ public class Grid { } private static class Point { + private final int row; private final int column; diff --git a/gilded-rose-without-flow-control/src/main/java/com/gildedrose/GildedRose.java b/gilded-rose-without-flow-control/src/main/java/com/gildedrose/GildedRose.java index cb63f4fc9fd4ef6d684ff1f980f0a08c4949c1ca..799e7d45c10b51fc1f9c3e32f7f79c757748ed85 100644 --- a/gilded-rose-without-flow-control/src/main/java/com/gildedrose/GildedRose.java +++ b/gilded-rose-without-flow-control/src/main/java/com/gildedrose/GildedRose.java @@ -3,6 +3,7 @@ package com.gildedrose; import java.util.Arrays; class GildedRose { + Item[] items; public GildedRose(Item[] items) { diff --git a/gilded-rose-without-flow-control/src/main/java/com/gildedrose/Item.java b/gilded-rose-without-flow-control/src/main/java/com/gildedrose/Item.java index 8728dcf786c0720bb5f21f8d31e15732d94c56e8..cc41e8ca6aa53f46ec4e1c1bb3b0285539639649 100644 --- a/gilded-rose-without-flow-control/src/main/java/com/gildedrose/Item.java +++ b/gilded-rose-without-flow-control/src/main/java/com/gildedrose/Item.java @@ -1,6 +1,7 @@ package com.gildedrose; public class Item { + public String name; public int sellIn; diff --git a/gilded-rose-without-flow-control/src/main/java/com/gildedrose/WarehouseItem.java b/gilded-rose-without-flow-control/src/main/java/com/gildedrose/WarehouseItem.java index af17938b156b2d4564c9e0b7274f2e9066b8e96e..68400c6c380d3e5fd620c61f11046860830916c3 100644 --- a/gilded-rose-without-flow-control/src/main/java/com/gildedrose/WarehouseItem.java +++ b/gilded-rose-without-flow-control/src/main/java/com/gildedrose/WarehouseItem.java @@ -3,6 +3,7 @@ package com.gildedrose; import java.util.Optional; public abstract class WarehouseItem { + private final Item item; public WarehouseItem(Item item) { diff --git a/gilded-rose-without-flow-control/src/main/java/com/gildedrose/WarehouseItems.java b/gilded-rose-without-flow-control/src/main/java/com/gildedrose/WarehouseItems.java index 3e80361d168292e92e01539e593b6a71f5f62b2b..8d003b96615b3f5a6fcd4cfe7ecbeca06bf524a3 100644 --- a/gilded-rose-without-flow-control/src/main/java/com/gildedrose/WarehouseItems.java +++ b/gilded-rose-without-flow-control/src/main/java/com/gildedrose/WarehouseItems.java @@ -4,6 +4,7 @@ import java.util.Map; import java.util.function.Function; class WarehouseItems { + private static final String SULFURAS_NAME = "Sulfuras, Hand of Ragnaros"; private static final String BACKSTAGE_PASSES_NAME = "Backstage passes to a TAFKAL80ETC concert"; private static final String AGED_BRIE_NAME = "Aged Brie"; diff --git a/gilded-rose-without-flow-control/src/test/java/com/gildedrose/GildedRoseGolden.java b/gilded-rose-without-flow-control/src/test/java/com/gildedrose/GildedRoseGolden.java index 9ac08abce7552302f71befc53935f72667e3721f..3276c6fd89a07a48a69421e1f522d65d27b6e8de 100644 --- a/gilded-rose-without-flow-control/src/test/java/com/gildedrose/GildedRoseGolden.java +++ b/gilded-rose-without-flow-control/src/test/java/com/gildedrose/GildedRoseGolden.java @@ -1,6 +1,7 @@ package com.gildedrose; class GildedRoseGolden { + Item[] items; public GildedRoseGolden(Item[] items) { diff --git a/gilded-rose-without-flow-control/src/test/java/com/gildedrose/ItemsProvider.java b/gilded-rose-without-flow-control/src/test/java/com/gildedrose/ItemsProvider.java index cbe7eba60fb505111a9046afa66cad5005066c36..e347ee974df7ecbd3c15c79d7f44f5540fcf9e3a 100644 --- a/gilded-rose-without-flow-control/src/test/java/com/gildedrose/ItemsProvider.java +++ b/gilded-rose-without-flow-control/src/test/java/com/gildedrose/ItemsProvider.java @@ -11,7 +11,7 @@ public final class ItemsProvider { new Item("Sulfuras, Hand of Ragnaros", -1, 80), new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49) + new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), }; return items; diff --git a/gilded-rose/src/main/java/com/gildedrose/GildedRose.java b/gilded-rose/src/main/java/com/gildedrose/GildedRose.java index 76feabff2b8aacc482678166f7fc35566f21dffe..a955a513dcaef37527a227044a6f5f81b015e944 100644 --- a/gilded-rose/src/main/java/com/gildedrose/GildedRose.java +++ b/gilded-rose/src/main/java/com/gildedrose/GildedRose.java @@ -1,6 +1,7 @@ package com.gildedrose; class GildedRose { + private static final String SULFURAS_NAME = "Sulfuras, Hand of Ragnaros"; private static final String BACKSTAGE_PASSES_NAME = "Backstage passes to a TAFKAL80ETC concert"; private static final String AGED_BRIE_NAME = "Aged Brie"; diff --git a/gilded-rose/src/main/java/com/gildedrose/Item.java b/gilded-rose/src/main/java/com/gildedrose/Item.java index 8728dcf786c0720bb5f21f8d31e15732d94c56e8..cc41e8ca6aa53f46ec4e1c1bb3b0285539639649 100644 --- a/gilded-rose/src/main/java/com/gildedrose/Item.java +++ b/gilded-rose/src/main/java/com/gildedrose/Item.java @@ -1,6 +1,7 @@ package com.gildedrose; public class Item { + public String name; public int sellIn; diff --git a/gilded-rose/src/test/java/com/gildedrose/GildedRoseGolden.java b/gilded-rose/src/test/java/com/gildedrose/GildedRoseGolden.java index 9ac08abce7552302f71befc53935f72667e3721f..3276c6fd89a07a48a69421e1f522d65d27b6e8de 100644 --- a/gilded-rose/src/test/java/com/gildedrose/GildedRoseGolden.java +++ b/gilded-rose/src/test/java/com/gildedrose/GildedRoseGolden.java @@ -1,6 +1,7 @@ package com.gildedrose; class GildedRoseGolden { + Item[] items; public GildedRoseGolden(Item[] items) { diff --git a/gilded-rose/src/test/java/com/gildedrose/ItemsProvider.java b/gilded-rose/src/test/java/com/gildedrose/ItemsProvider.java index cbe7eba60fb505111a9046afa66cad5005066c36..e347ee974df7ecbd3c15c79d7f44f5540fcf9e3a 100644 --- a/gilded-rose/src/test/java/com/gildedrose/ItemsProvider.java +++ b/gilded-rose/src/test/java/com/gildedrose/ItemsProvider.java @@ -11,7 +11,7 @@ public final class ItemsProvider { new Item("Sulfuras, Hand of Ragnaros", -1, 80), new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), - new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49) + new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), }; return items; diff --git a/java-concurrence/src/test/java/fr/craft/kata/ThreadingTest.java b/java-concurrence/src/test/java/fr/craft/kata/ThreadingTest.java index 8c374b752a05f513478eff7c1a9f652e75534f22..48b6295b975a00d20e42b21275dbf7c2c4e2926f 100644 --- a/java-concurrence/src/test/java/fr/craft/kata/ThreadingTest.java +++ b/java-concurrence/src/test/java/fr/craft/kata/ThreadingTest.java @@ -89,6 +89,7 @@ public class ThreadingTest { } private static class StopableThread implements Runnable { + private AtomicBoolean running = new AtomicBoolean(true); @Override diff --git a/java-h2g2/src/main/java/fr/ippon/kata/h2g2/Book.java b/java-h2g2/src/main/java/fr/ippon/kata/h2g2/Book.java index 4dd9649bb6c67d6cb690d56f7e7f64523f61db8a..f9923d196ee624a5e382fe1189b19d2c2ab8e3fa 100644 --- a/java-h2g2/src/main/java/fr/ippon/kata/h2g2/Book.java +++ b/java-h2g2/src/main/java/fr/ippon/kata/h2g2/Book.java @@ -5,5 +5,5 @@ public enum Book { SECOND, THIRD, FORTH, - FIFTH + FIFTH, } diff --git a/java-h2g2/src/main/java/fr/ippon/kata/h2g2/Shop.java b/java-h2g2/src/main/java/fr/ippon/kata/h2g2/Shop.java index 38cb3d290318dfa4c38352a141a6d5346a6e330f..1ddf991769b63b57a78b0f11d40d11dbe9fa45df 100644 --- a/java-h2g2/src/main/java/fr/ippon/kata/h2g2/Shop.java +++ b/java-h2g2/src/main/java/fr/ippon/kata/h2g2/Shop.java @@ -16,6 +16,7 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; public class Shop { + private static final Map<Integer, Float> FACTORS = buildFactors(); private static final int BOOK_PRICE = 8; @@ -43,6 +44,7 @@ public class Shop { } private static final class Basket { + private final Collection<Integer> packs; public Basket(Book... books) { diff --git a/java-pagination-seven/src/main/java/fr/ippon/kata/pagination/Pagination.java b/java-pagination-seven/src/main/java/fr/ippon/kata/pagination/Pagination.java index 24d8dc08360dcd2863ee9c4cc500e7a230b765dd..3022b7acced7f6f9248d6891afb4ad5323b8a2de 100644 --- a/java-pagination-seven/src/main/java/fr/ippon/kata/pagination/Pagination.java +++ b/java-pagination-seven/src/main/java/fr/ippon/kata/pagination/Pagination.java @@ -5,6 +5,7 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; public class Pagination { + private static final String SPACE = " "; private static final String ELLIPSIS = " … "; @@ -78,6 +79,7 @@ public class Pagination { } public static class PaginationBuilder { + private final int current; private int total; diff --git a/java-puzzles/src/test/java/fr/ippon/PlayingWithInstanciations.java b/java-puzzles/src/test/java/fr/ippon/PlayingWithInstanciations.java index 6cda1b98a9687c89d9c0a0899a427eb77013b56d..b615a71fc1dd734cb5ba4512ed4b796200c64926 100644 --- a/java-puzzles/src/test/java/fr/ippon/PlayingWithInstanciations.java +++ b/java-puzzles/src/test/java/fr/ippon/PlayingWithInstanciations.java @@ -5,6 +5,7 @@ import static org.assertj.core.api.Assertions.*; import org.junit.jupiter.api.Test; public class PlayingWithInstanciations { + private static final long instanciation = System.currentTimeMillis(); @Test @@ -16,10 +17,11 @@ public class PlayingWithInstanciations { assertThat(start).isGreaterThan(instanciation); MyPrivateClass.doStuff(); assertThat(start).isLessThanOrEqualTo(MyPrivateClass.instanciation); - // assertThat(start).isGreaterThan(MyPrivateClass.instanciation); + // assertThat(start).isGreaterThan(MyPrivateClass.instanciation); } private static class MyPrivateClass { + private static final long instanciation = System.currentTimeMillis(); private static void doStuff() {} diff --git a/java-puzzles/src/test/java/fr/ippon/PlayingWithInteger.java b/java-puzzles/src/test/java/fr/ippon/PlayingWithInteger.java index 7c5b4c5e8504993a7e695cddeabb53bd32c3b4a5..ca23bc649e0ae951a524bf64b7eb1d7b12128736 100644 --- a/java-puzzles/src/test/java/fr/ippon/PlayingWithInteger.java +++ b/java-puzzles/src/test/java/fr/ippon/PlayingWithInteger.java @@ -12,7 +12,7 @@ public class PlayingWithInteger { Integer b = 42; assertThat(a).isSameAs(b); - // assertThat(a).isNotSameAs(b); + // assertThat(a).isNotSameAs(b); } @Test diff --git a/java-puzzles/src/test/java/fr/ippon/PlayingWithString.java b/java-puzzles/src/test/java/fr/ippon/PlayingWithString.java index 4a5a8676d8a80b57820363d9736de7f535a27b45..8a6cba77babde6d464ca15aa43058ef844547ccd 100644 --- a/java-puzzles/src/test/java/fr/ippon/PlayingWithString.java +++ b/java-puzzles/src/test/java/fr/ippon/PlayingWithString.java @@ -9,7 +9,7 @@ public class PlayingWithString { @Test public void playingWithReferences() { assertThat("coucou").isSameAs("coucou"); - // assertThat("coucou").isNotSameAs("coucou"); + // assertThat("coucou").isNotSameAs("coucou"); } @Test @@ -21,7 +21,7 @@ public class PlayingWithString { @Test public void playingWithIntern() { assertThat(new String("coucou").intern()).isSameAs(new String("coucou").intern()); - // assertThat(new String("coucou").intern()).isNotSameAs(new - // String("coucou").intern()); + // assertThat(new String("coucou").intern()).isNotSameAs(new + // String("coucou").intern()); } } diff --git a/java-puzzles/src/test/java/fr/ippon/PlayingWithThreads.java b/java-puzzles/src/test/java/fr/ippon/PlayingWithThreads.java index c80e745c6a25f9d3159b46e795da6dea03860153..55c7cbef610a8a238fcf7b46b24fefbbe92b6acb 100644 --- a/java-puzzles/src/test/java/fr/ippon/PlayingWithThreads.java +++ b/java-puzzles/src/test/java/fr/ippon/PlayingWithThreads.java @@ -17,6 +17,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.junit.jupiter.api.Test; public class PlayingWithThreads { + private static boolean threadDoneFlag; private static AtomicBoolean threadDoneAtomicFlag = new AtomicBoolean(false); @@ -55,7 +56,7 @@ public class PlayingWithThreads { threadStopped.set(true); } ) - .start(); + .start(); Thread.sleep(500); @@ -63,7 +64,7 @@ public class PlayingWithThreads { Thread.sleep(50); assertThat(threadStopped.get()).isFalse(); - // assertThat(threadStopped.get()).isTrue(); + // assertThat(threadStopped.get()).isTrue(); } @Test @@ -79,7 +80,7 @@ public class PlayingWithThreads { threadStopped.set(true); } ) - .start(); + .start(); Thread.sleep(500); @@ -102,7 +103,7 @@ public class PlayingWithThreads { threadStopped.set(true); } ) - .start(); + .start(); Thread.sleep(500); diff --git a/java-streams/src/main/java/fr/ippon/streams/Employee.java b/java-streams/src/main/java/fr/ippon/streams/Employee.java index 529507115198b4133b47ac5bd1388d1184477da1..55b15991a1815525861c45ecf583aec41b4c2cb5 100644 --- a/java-streams/src/main/java/fr/ippon/streams/Employee.java +++ b/java-streams/src/main/java/fr/ippon/streams/Employee.java @@ -1,6 +1,7 @@ package fr.ippon.streams; public class Employee { + private final String name; private final int age; diff --git a/java-streams/src/main/java/fr/ippon/streams/Mall.java b/java-streams/src/main/java/fr/ippon/streams/Mall.java index 33fe85555962257b1662c37ab397b1585cbb0806..5b472a5aae69d5e12845da290952eddac27c2eab 100644 --- a/java-streams/src/main/java/fr/ippon/streams/Mall.java +++ b/java-streams/src/main/java/fr/ippon/streams/Mall.java @@ -9,6 +9,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; public class Mall { + private final List<Shop> shops; public Mall(Shop... shops) { diff --git a/java-streams/src/main/java/fr/ippon/streams/Shop.java b/java-streams/src/main/java/fr/ippon/streams/Shop.java index 1c4d1c301227a38dccbb05470cd5272d78c95810..f0c2d5c1c872d5fd5c6c84e387d3094eeabf241d 100644 --- a/java-streams/src/main/java/fr/ippon/streams/Shop.java +++ b/java-streams/src/main/java/fr/ippon/streams/Shop.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Collection; public class Shop { + private final String name; private final Collection<Employee> employees; diff --git a/java-streams/src/test/java/fr/ippon/streams/MallUnitTest.java b/java-streams/src/test/java/fr/ippon/streams/MallUnitTest.java index 4bdfd540fce8daeb4da73b98289b91510232c1ed..66814859055f84206d2fa3b789e5ca12457a11a8 100644 --- a/java-streams/src/test/java/fr/ippon/streams/MallUnitTest.java +++ b/java-streams/src/test/java/fr/ippon/streams/MallUnitTest.java @@ -5,6 +5,7 @@ import static org.assertj.core.api.Assertions.*; import org.junit.jupiter.api.Test; public class MallUnitTest { + private static final Mall mall = mall(shop("Nature", employee("Michel", 25)), shop("Beer", employee("Bob", 42), employee("John", 19))); @Test diff --git a/leap-years/src/main/java/fr/ippon/leapyears/Years.java b/leap-years/src/main/java/fr/ippon/leapyears/Years.java index ce9d05e5fa6c386ec16b7ff3e5ee5ab0e5c0e8cf..058dbd90f5cd3062908d65ad574436012b37cee5 100644 --- a/leap-years/src/main/java/fr/ippon/leapyears/Years.java +++ b/leap-years/src/main/java/fr/ippon/leapyears/Years.java @@ -7,6 +7,7 @@ public class Years { } private static class Year { + private final int year; public Year(int year) { diff --git a/movie-rental/src/main/java/fr/ippon/rental/Customer.java b/movie-rental/src/main/java/fr/ippon/rental/Customer.java index 39fc4e02a903b432b29c7f20e5bbff88647efc34..56a84fdf7d175a108c67b2df3492df5e9dc1293c 100644 --- a/movie-rental/src/main/java/fr/ippon/rental/Customer.java +++ b/movie-rental/src/main/java/fr/ippon/rental/Customer.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; public class Customer { + private final String name; private final List<Rental> rentals = new ArrayList<Rental>(); diff --git a/movie-rental/src/main/java/fr/ippon/rental/Movie.java b/movie-rental/src/main/java/fr/ippon/rental/Movie.java index e545ba3051642efaa9a25b11dcfa315bc3b1b316..f8e96a30c9adb3f2c24d564e121c35cd46d60199 100644 --- a/movie-rental/src/main/java/fr/ippon/rental/Movie.java +++ b/movie-rental/src/main/java/fr/ippon/rental/Movie.java @@ -1,6 +1,7 @@ package fr.ippon.rental; public abstract class Movie { + private final String title; public Movie(String title) { diff --git a/movie-rental/src/main/java/fr/ippon/rental/Rental.java b/movie-rental/src/main/java/fr/ippon/rental/Rental.java index b7938892dfe3f41e62c7e19b4411971c808b5bab..2ec0f46b0416a6895e1e46924b3803aa30b54f4f 100644 --- a/movie-rental/src/main/java/fr/ippon/rental/Rental.java +++ b/movie-rental/src/main/java/fr/ippon/rental/Rental.java @@ -4,6 +4,7 @@ package fr.ippon.rental; * The rental class represents a customer renting a movie. */ public class Rental { + private final Movie movie; private final int daysRented; diff --git a/mustache-replacer/src/main/java/ArgumentReplacer.java b/mustache-replacer/src/main/java/ArgumentReplacer.java index 68361634bbbdd2745ea09dc7702a882dd736cbdb..9b840c8361fad63bc39587f8149f06842d663eea 100644 --- a/mustache-replacer/src/main/java/ArgumentReplacer.java +++ b/mustache-replacer/src/main/java/ArgumentReplacer.java @@ -3,25 +3,26 @@ import java.util.function.BinaryOperator; public class ArgumentReplacer { - public static final String BEGINING_MUSTACH = "\\{\\{\\s*"; - public static final String ENDING_MUSTACH = "\\s*\\}\\}"; + public static final String BEGINING_MUSTACH = "\\{\\{\\s*"; + public static final String ENDING_MUSTACH = "\\s*\\}\\}"; - public static String replace(String template, Map<String, String> arguments) { - if (needNoReplace(template, arguments)) { - return template; - } - - return arguments.entrySet().stream().reduce(template, ArgumentReplacer::replaceEntry, nothing()); + public static String replace(String template, Map<String, String> arguments) { + if (needNoReplace(template, arguments)) { + return template; } - private static boolean needNoReplace(String template, Map<String, String> arguments) { - return template == null || arguments == null; - } - private static String replaceEntry(String result, Map.Entry<String, String> entry) { - return result.replaceAll(BEGINING_MUSTACH + entry.getKey() + ENDING_MUSTACH, entry.getValue()); - } + return arguments.entrySet().stream().reduce(template, ArgumentReplacer::replaceEntry, nothing()); + } - private static BinaryOperator<String> nothing() { - return (k, v) -> v; - } + private static boolean needNoReplace(String template, Map<String, String> arguments) { + return template == null || arguments == null; + } + + private static String replaceEntry(String result, Map.Entry<String, String> entry) { + return result.replaceAll(BEGINING_MUSTACH + entry.getKey() + ENDING_MUSTACH, entry.getValue()); + } + + private static BinaryOperator<String> nothing() { + return (k, v) -> v; + } } diff --git a/mustache-replacer/src/test/java/ArgumentReplacerTest.java b/mustache-replacer/src/test/java/ArgumentReplacerTest.java index 3b89e1d5b2988b52ddd2af98776dfb3847c15de9..37eab0a38d3563ec7026ab9b5b8b60284e53e649 100644 --- a/mustache-replacer/src/test/java/ArgumentReplacerTest.java +++ b/mustache-replacer/src/test/java/ArgumentReplacerTest.java @@ -1,35 +1,29 @@ -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; class SampleTest { - @Test - void shouldGetInputStringWithoutArgumentToReplace() { - - assertThat(ArgumentReplacer.replace("Bonjour Homer", null)).isEqualTo("Bonjour Homer"); - } - - @Test - void shouldGetInputStringWithArgumentReplaced() { - - assertThat(ArgumentReplacer.replace("Bonjour {{firstname}}", Map.of("firstname", "Homer"))).isEqualTo("Bonjour Homer"); - } - - @Test - void shouldGetNullResultWithoutTemplate(){ - - assertThat(ArgumentReplacer.replace(null, Map.of("firstname", "Homer"))).isNull(); - } - - @Test - void shouldGetInputStringReplacedWithSpace(){ - - assertThat(ArgumentReplacer.replace("Bonjour {{firstname}} {{ lastname }}", Map.of("firstname","Homer", "lastname", "Simpson"))).isEqualTo("Bonjour Homer Simpson"); - } - - + @Test + void shouldGetInputStringWithoutArgumentToReplace() { + assertThat(ArgumentReplacer.replace("Bonjour Homer", null)).isEqualTo("Bonjour Homer"); + } + + @Test + void shouldGetInputStringWithArgumentReplaced() { + assertThat(ArgumentReplacer.replace("Bonjour {{firstname}}", Map.of("firstname", "Homer"))).isEqualTo("Bonjour Homer"); + } + + @Test + void shouldGetNullResultWithoutTemplate() { + assertThat(ArgumentReplacer.replace(null, Map.of("firstname", "Homer"))).isNull(); + } + + @Test + void shouldGetInputStringReplacedWithSpace() { + assertThat(ArgumentReplacer.replace("Bonjour {{firstname}} {{ lastname }}", Map.of("firstname", "Homer", "lastname", "Simpson"))) + .isEqualTo("Bonjour Homer Simpson"); + } } diff --git a/package-lock.json b/package-lock.json index d6d6ff4a87e60a8529c29f52dc28f4ca97d06813..b9bb3235d71a75522bb91f16e439272a50015ec7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -108,6 +108,12 @@ "any-observable": "^0.3.0" } }, + "@types/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==", + "dev": true + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -124,9 +130,9 @@ "dev": true }, "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", "dev": true, "requires": { "normalize-path": "^3.0.0", @@ -166,6 +172,12 @@ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, + "array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true + }, "array-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", @@ -267,9 +279,9 @@ } }, "binary-extensions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", - "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, "brace-expansion": { @@ -375,14 +387,14 @@ } }, "chokidar": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", - "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", "dev": true, "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.2", + "fsevents": "~2.3.1", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", @@ -889,12 +901,13 @@ "dev": true }, "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "requires": { - "locate-path": "^3.0.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" } }, "fn-name": { @@ -925,9 +938,9 @@ "dev": true }, "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "optional": true }, @@ -948,12 +961,6 @@ "integrity": "sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==", "dev": true }, - "get-stdin": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", - "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", - "dev": true - }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -984,9 +991,9 @@ } }, "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "requires": { "is-glob": "^4.0.1" @@ -1047,73 +1054,17 @@ } } }, - "hosted-git-info": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", - "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", "dev": true }, "husky": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/husky/-/husky-1.3.1.tgz", - "integrity": "sha512-86U6sVVVf4b5NYSZ0yvv88dRgBSSXXmHaiq5pP4KDj5JVzdwKgBjEtUPOm8hcoytezFwbU+7gotXNhpHdystlg==", - "dev": true, - "requires": { - "cosmiconfig": "^5.0.7", - "execa": "^1.0.0", - "find-up": "^3.0.0", - "get-stdin": "^6.0.0", - "is-ci": "^2.0.0", - "pkg-dir": "^3.0.0", - "please-upgrade-node": "^3.1.1", - "read-pkg": "^4.0.1", - "run-node": "^1.0.0", - "slash": "^2.0.0" - }, - "dependencies": { - "ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, - "is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, - "requires": { - "ci-info": "^2.0.0" - } - }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, - "read-pkg": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz", - "integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=", - "dev": true, - "requires": { - "normalize-package-data": "^2.3.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0" - } - } - } + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/husky/-/husky-6.0.0.tgz", + "integrity": "sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ==", + "dev": true }, "ignore": { "version": "5.1.8", @@ -1335,21 +1286,13 @@ "dev": true }, "java-parser": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/java-parser/-/java-parser-0.6.0.tgz", - "integrity": "sha512-oqazDAfGVrraBu/vMTboXPv1ZDeXYSJ1AdLGxR/BTRU6F2Va1HsV2WD41RhZJ0f0SOtFwzPrEuGoiNq+ZPTWQw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/java-parser/-/java-parser-1.0.2.tgz", + "integrity": "sha512-lBXc+F62ds2W83eH5MwGnzuWdb6kgGBV0x0R7w0B4JKGDrJzolMUEhRMzzzlIX68HvRU7XtfPon22YaB+dVg+A==", "dev": true, "requires": { "chevrotain": "6.5.0", - "lodash": "4.17.15" - }, - "dependencies": { - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", - "dev": true - } + "lodash": "4.17.21" } }, "js-yaml": { @@ -1633,13 +1576,12 @@ } }, "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" + "p-locate": "^4.1.0" } }, "lodash": { @@ -1741,6 +1683,12 @@ "escape-string-regexp": "^1.0.4" } }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -1798,12 +1746,45 @@ } } }, + "mri": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz", + "integrity": "sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==", + "dev": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "multimatch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", + "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", + "dev": true, + "requires": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + }, + "dependencies": { + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true + } + } + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -1829,26 +1810,6 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -1955,9 +1916,9 @@ } }, "onchange": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/onchange/-/onchange-7.0.2.tgz", - "integrity": "sha512-pyJroR9gZKilbJtdGsuyxhFhwaeYSpYVle9hAORGJ5vQQH8n7QT+qWpncJTMEk9dlIXI9tOMjdJwbPaTSPTKFA==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/onchange/-/onchange-7.1.0.tgz", + "integrity": "sha512-ZJcqsPiWUAUpvmnJri5TPBooqJOPmC0ttN65juhN15Q8xA+Nbg3BaxBHXQ45EistKKlKElb0edmbPWnKSBkvMg==", "dev": true, "requires": { "@blakeembrey/deque": "^1.0.5", @@ -2037,12 +1998,12 @@ } }, "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "requires": { - "p-limit": "^2.0.0" + "p-limit": "^2.2.0" } }, "p-try": { @@ -2058,9 +2019,9 @@ "dev": true }, "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true }, "path-is-absolute": { @@ -2081,16 +2042,10 @@ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, "picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", + "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", "dev": true }, "pinkie": { @@ -2108,15 +2063,6 @@ "pinkie": "^2.0.0" } }, - "pkg-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", - "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", - "dev": true, - "requires": { - "find-up": "^3.0.0" - } - }, "please-upgrade-node": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", @@ -2133,33 +2079,181 @@ "dev": true }, "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", "dev": true }, "prettier-plugin-java": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/prettier-plugin-java/-/prettier-plugin-java-0.6.0.tgz", - "integrity": "sha512-iZOmKTN0N+/bulDTJI61TrYbu8fApstp+docHKxagFZDgOSW8CP246bTpJkgfLrsv91cSIIa9cYyDjwkz1pFGA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/prettier-plugin-java/-/prettier-plugin-java-1.0.2.tgz", + "integrity": "sha512-YgcN1WGZlrH0E+bHdqtIYtfDp6k2PHBnIaGjzdff/7t/NyDWAA6ypAmnD7YQVG2OuoIaXYkC37HN7cz68lLWLg==", + "dev": true, + "requires": { + "java-parser": "1.0.2", + "lodash": "4.17.21", + "prettier": "2.2.1" + } + }, + "pretty-quick": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.0.tgz", + "integrity": "sha512-DtxIxksaUWCgPFN7E1ZZk4+Aav3CCuRdhrDSFZENb404sYMtuo9Zka823F+Mgeyt8Zt3bUiCjFzzWYE9LYqkmQ==", "dev": true, "requires": { - "java-parser": "^0.6.0", - "lodash": "4.17.15", - "prettier": "1.18.2" + "chalk": "^3.0.0", + "execa": "^4.0.0", + "find-up": "^4.1.0", + "ignore": "^5.1.4", + "mri": "^1.1.5", + "multimatch": "^4.0.0" }, "dependencies": { - "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "execa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", + "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "prettier": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz", - "integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==", + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", "dev": true + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } } } }, @@ -2216,15 +2310,6 @@ "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "dev": true }, - "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, "resolve-from": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", @@ -2262,12 +2347,6 @@ "glob": "^7.1.3" } }, - "run-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/run-node/-/run-node-1.0.0.tgz", - "integrity": "sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A==", - "dev": true - }, "rxjs": { "version": "6.6.0", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.0.tgz", @@ -2345,12 +2424,6 @@ "debug": "^4.0.1" } }, - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", - "dev": true - }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -2498,38 +2571,6 @@ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "dev": true }, - "spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", - "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", - "dev": true - }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -2603,6 +2644,12 @@ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -2742,16 +2789,6 @@ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/package.json b/package.json index c66160c0553937e231688b21de3a2596cfa02602..8b7bf2f577bb1b8db3bb606f87d0712d1d2afe90 100644 --- a/package.json +++ b/package.json @@ -8,23 +8,20 @@ "node_modules" ], "devDependencies": { - "husky": "1.3.1", + "husky": "^6.0.0", "lint-staged": "8.1.4", - "onchange": "^7.0.2", - "prettier": "^1.19.1", - "prettier-plugin-java": "^0.6.0" + "onchange": "^7.1.0", + "prettier": "^2.2.1", + "prettier-plugin-java": "1.0.2", + "pretty-quick": "^3.1.0" }, "engines": { "node": ">= 12.16.1", "npm": ">= 6.13.4" }, - "lint-staged": { - "**/*.{md,json,js,ts,tsx,css,scss,yml,yaml,java}": [ - "prettier --write", - "git add" - ] - }, "scripts": { + "prepare": "husky install", + "pretty-quick:staged": "pretty-quick --staged --pattern \"**/*.*(java|xml|md)\"", "prettier:java": "prettier --write \"**/*.java\" --plugin=./node_modules/prettier-plugin-java", "prettier:java:watch": "onchange '**/*.java' -- prettier --write {{changed}} --plugin=./node_modules/prettier-plugin-java", "prettier:java:check": "prettier --check \"**/*.java\" --plugin=./node_modules/prettier-plugin-java" diff --git a/puissance-4/src/main/java/fr/ippon/kata/puissance4/Joueur.java b/puissance-4/src/main/java/fr/ippon/kata/puissance4/Joueur.java index 06c72a3cb6608c7ae2fefff2ffa1654257ed1c8d..9219fa8adfd6348024299be12b1e6f4d033d502b 100644 --- a/puissance-4/src/main/java/fr/ippon/kata/puissance4/Joueur.java +++ b/puissance-4/src/main/java/fr/ippon/kata/puissance4/Joueur.java @@ -3,6 +3,7 @@ package fr.ippon.kata.puissance4; public enum Joueur { JOUEUR_1('X'), JOUEUR_2('O'); + private final char pion; private Joueur(char pion) { diff --git a/puissance-4/src/main/java/fr/ippon/kata/puissance4/Puissance4.java b/puissance-4/src/main/java/fr/ippon/kata/puissance4/Puissance4.java index 130f84f92dc05b24f5bd32731849c5cc52fa6605..fb6adf27a20a18d63ff9a3fabb636c82e1e5fbd0 100644 --- a/puissance-4/src/main/java/fr/ippon/kata/puissance4/Puissance4.java +++ b/puissance-4/src/main/java/fr/ippon/kata/puissance4/Puissance4.java @@ -5,6 +5,7 @@ import static fr.ippon.kata.puissance4.Joueur.*; import java.util.Scanner; public class Puissance4 { + private static final Integer N = 20; private Character grille[][]; @@ -132,9 +133,8 @@ public class Puissance4 { grille[i + 1][j + 1] == 'O' && grille[i + 1][j + 1] == grille[i + 2][j + 2] && grille[i + 2][j + 2] == grille[i + 3][j + 3] - ) /* new */ - || - ( + ) || + /* new */( grille[i + 1][j + 1] == 'O' && grille[i - 1][j - 1] == grille[i + 1][j + 1] && grille[i - 1][j - 1] == grille[i - 2][j - 2] diff --git a/puissance-4/src/test/java/fr/ippon/kata/puissance4/Puissance4Test.java b/puissance-4/src/test/java/fr/ippon/kata/puissance4/Puissance4Test.java index ac3739fa306f434d7db628588c70113391375c03..7eede41fce2e059b36e37cfe6c6c789d737ded79 100644 --- a/puissance-4/src/test/java/fr/ippon/kata/puissance4/Puissance4Test.java +++ b/puissance-4/src/test/java/fr/ippon/kata/puissance4/Puissance4Test.java @@ -17,6 +17,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; class Puissance4Test { + private PrintStream systemOut; private InputStream systemIn; @@ -149,6 +150,7 @@ class Puissance4Test { } private static class SystemInMock extends InputStream { + private StringReader currentReader; private IOException ioException; private RuntimeException runtimeException; diff --git a/roman-numerals/src/main/java/fr/ippon/kata/roman/Numerals.java b/roman-numerals/src/main/java/fr/ippon/kata/roman/Numerals.java index b2b9d091e3f5481e85d0a94d07bb8d2e27edbc88..97403213a6bd0815bb33a2d0467e3f8efcabbd98 100644 --- a/roman-numerals/src/main/java/fr/ippon/kata/roman/Numerals.java +++ b/roman-numerals/src/main/java/fr/ippon/kata/roman/Numerals.java @@ -4,6 +4,7 @@ import java.util.NavigableMap; import java.util.TreeMap; public final class Numerals { + private static final NavigableMap<Integer, Roman> CONVERSIONS = buildConversions(); private Numerals() {} diff --git a/roman-numerals/src/main/java/fr/ippon/kata/roman/Roman.java b/roman-numerals/src/main/java/fr/ippon/kata/roman/Roman.java index 5e4f6de2243247008fb6055c232597bcea2b471c..7f7cad176f3a2c78cb4f9a5f3f08893bcfaffb6f 100644 --- a/roman-numerals/src/main/java/fr/ippon/kata/roman/Roman.java +++ b/roman-numerals/src/main/java/fr/ippon/kata/roman/Roman.java @@ -6,6 +6,7 @@ public enum Roman { FIVE("V"), NINE("IX"), TEN("X"); + private String representation; private Roman(String representation) { diff --git a/string-calculator-2/src/main/java/fr/ippon/stringcalculator/StringCalculator.java b/string-calculator-2/src/main/java/fr/ippon/stringcalculator/StringCalculator.java index d5f5288cb350e5400b46381c199bd8697cf6bdc0..3d4871634920a283a4485860fbc3e4e4becd5944 100644 --- a/string-calculator-2/src/main/java/fr/ippon/stringcalculator/StringCalculator.java +++ b/string-calculator-2/src/main/java/fr/ippon/stringcalculator/StringCalculator.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import java.util.Arrays; public final class StringCalculator { + private static final String SEPARATOR = ",|\n"; private StringCalculator() {} diff --git a/tcr-roman-numerals/src/main/java/fr/ippon/kata/numeral/Numerals.java b/tcr-roman-numerals/src/main/java/fr/ippon/kata/numeral/Numerals.java index 6cfb575c57726dcd1457a7f571727db30675f0e5..3562dd29636f7cfc35cc0f9c38e6404949a13545 100644 --- a/tcr-roman-numerals/src/main/java/fr/ippon/kata/numeral/Numerals.java +++ b/tcr-roman-numerals/src/main/java/fr/ippon/kata/numeral/Numerals.java @@ -7,6 +7,7 @@ import java.util.TreeMap; import java.util.function.Function; public class Numerals { + private static final NavigableMap<Integer, String> CONVERSIONS = buildConversions(); private Numerals() {} diff --git a/tennis/greenfield-2/src/main/java/fr/ippon/tennis/Game.java b/tennis/greenfield-2/src/main/java/fr/ippon/tennis/Game.java index f00f3beb2ce056b7b8921ed0edad684ff95dabc9..ef3486b4539f01eba5afc793e49b8493c7e7ca40 100644 --- a/tennis/greenfield-2/src/main/java/fr/ippon/tennis/Game.java +++ b/tennis/greenfield-2/src/main/java/fr/ippon/tennis/Game.java @@ -1,6 +1,7 @@ package fr.ippon.tennis; public class Game { + private static final String STARTING_DISPLAY = "LOVE - ALL"; private static final String SEPARATOR = " - "; diff --git a/tennis/greenfield-2/src/main/java/fr/ippon/tennis/Score.java b/tennis/greenfield-2/src/main/java/fr/ippon/tennis/Score.java index d44448cca3354029ee3e04f17734232225bec49b..92dea51dde22b1a31c38711f6d4dc9028fef07dd 100644 --- a/tennis/greenfield-2/src/main/java/fr/ippon/tennis/Score.java +++ b/tennis/greenfield-2/src/main/java/fr/ippon/tennis/Score.java @@ -11,6 +11,7 @@ public enum Score { THIRTY(2, "30"), // FOURTY(3, "40"), // ENDING(4, "GAME"); + private static final Map<Integer, Score> SCORES = buildScores(); private final int index; diff --git a/tennis/greenfield-2/src/test/java/fr/ippon/tennis/GameTest.java b/tennis/greenfield-2/src/test/java/fr/ippon/tennis/GameTest.java index 7b6ba6216deb3e801cc79b416880816af163811a..cd44fe12745e2c86bf15874a11b13c5eac0c966d 100644 --- a/tennis/greenfield-2/src/test/java/fr/ippon/tennis/GameTest.java +++ b/tennis/greenfield-2/src/test/java/fr/ippon/tennis/GameTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; class GameTest { + private final Game game = new Game(); @Test diff --git a/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame.java b/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame.java index b61bd08eca965a154b4601e59f5dc14692c35c4b..4a2ef5339a49c4dafd2a75725db92d8bd3366ed1 100644 --- a/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame.java +++ b/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame.java @@ -1,7 +1,7 @@ package fr.ippon.kata; public interface TennisGame { - void wonPoint(String playerName); + void wonPoint(String playerName); - String score(); + String score(); } diff --git a/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame1.java b/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame1.java index a80e8cd1a8fe0be99a14e79a84c3cb0a7e59c466..d962671a9e546be87c59dca9ff0a26fa8a48a688 100644 --- a/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame1.java +++ b/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame1.java @@ -1,78 +1,70 @@ package fr.ippon.kata; - import java.util.Map; public class TennisGame1 implements TennisGame { - private static final String LOVE = "Love"; - private static final String FIFTEEN = "Fifteen"; - private static final String THIRTY = "Thirty"; - private static final String FORTY = "Forty"; - private static final String ALL = "All"; - private static final String DEUCE = "Deuce"; - private static final String SCORE_SEPARATOR = "-"; - - private static final Map<Integer, String> SCORES = Map.of(0, LOVE, 1, FIFTEEN, 2, THIRTY, 3, FORTY); - private static final String WIN_FOR = "Win for "; - private static final String ADVANTAGE = "Advantage "; - - private int player1Score = 0; - private int player2Score = 0; - private final String player1Name; - private final String player2Name; - - public TennisGame1(String player1Name, String player2Name) { - this.player1Name = player1Name; - this.player2Name = player2Name; + private static final String LOVE = "Love"; + private static final String FIFTEEN = "Fifteen"; + private static final String THIRTY = "Thirty"; + private static final String FORTY = "Forty"; + private static final String ALL = "All"; + private static final String DEUCE = "Deuce"; + private static final String SCORE_SEPARATOR = "-"; + + private static final Map<Integer, String> SCORES = Map.of(0, LOVE, 1, FIFTEEN, 2, THIRTY, 3, FORTY); + private static final String WIN_FOR = "Win for "; + private static final String ADVANTAGE = "Advantage "; + + private int player1Score = 0; + private int player2Score = 0; + private final String player1Name; + private final String player2Name; + + public TennisGame1(String player1Name, String player2Name) { + this.player1Name = player1Name; + this.player2Name = player2Name; + } + + public void wonPoint(String playerName) { + if (player1Name.equals(playerName)) player1Score += 1; else player2Score += 1; + } + + public String score() { + if (player1Score == player2Score) { + return equalityScore(); } - public void wonPoint(String playerName) { - if (player1Name.equals(playerName)) - player1Score += 1; - else - player2Score += 1; + if (player1Score >= 4 || player2Score >= 4) { + return endGameScore(); } - public String score() { - if (player1Score == player2Score) { - return equalityScore(); - } + return middleGameScore(); + } - if (player1Score >= 4 || player2Score >= 4) { - return endGameScore(); - } + private String middleGameScore() { + return SCORES.get(player1Score) + SCORE_SEPARATOR + SCORES.get(player2Score); + } - return middleGameScore(); - } + private String endGameScore() { + int player1AdvantageValue = player1Score - player2Score; - private String middleGameScore() { - return SCORES.get(player1Score) + - SCORE_SEPARATOR + - SCORES.get(player2Score); + if (Math.abs(player1AdvantageValue) == 1) { + return ADVANTAGE + advantagedPlayer(); } - private String endGameScore() { - int player1AdvantageValue = player1Score - player2Score; - - if (Math.abs(player1AdvantageValue) == 1) { - return ADVANTAGE + advantagedPlayer(); - } + return WIN_FOR + advantagedPlayer(); + } - return WIN_FOR + advantagedPlayer(); - } + private String advantagedPlayer() { + return player1Score > player2Score ? player1Name : player2Name; + } - private String advantagedPlayer() { - return player1Score > player2Score ? player1Name : player2Name; + private String equalityScore() { + if (player1Score >= 3) { + return DEUCE; } - private String equalityScore() { - if (player1Score >= 3) { - return DEUCE; - } - - return SCORES.get(player1Score) + - SCORE_SEPARATOR + - ALL; - } + return SCORES.get(player1Score) + SCORE_SEPARATOR + ALL; + } } diff --git a/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame2.java b/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame2.java index 97605197fd238c424908b684a626ed12357849c6..13b776995a907956c7fb12b3010eca5ec884e6a0 100644 --- a/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame2.java +++ b/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame2.java @@ -1,125 +1,100 @@ package fr.ippon.kata; - public class TennisGame2 implements TennisGame { - public int P1point = 0; - public int P2point = 0; - - public String P1res = ""; - public String P2res = ""; - private String player1Name; - private String player2Name; - - public TennisGame2(String player1Name, String player2Name) { - this.player1Name = player1Name; - this.player2Name = player2Name; - } - public String score() { - String score = ""; - if (P1point == P2point && P1point < 4) { - if (P1point == 0) - score = "Love"; - if (P1point == 1) - score = "Fifteen"; - if (P1point == 2) - score = "Thirty"; - score += "-All"; - } - if (P1point == P2point && P1point >= 3) - score = "Deuce"; - - if (P1point > 0 && P2point == 0) { - if (P1point == 1) - P1res = "Fifteen"; - if (P1point == 2) - P1res = "Thirty"; - if (P1point == 3) - P1res = "Forty"; - - P2res = "Love"; - score = P1res + "-" + P2res; - } - if (P2point > 0 && P1point == 0) { - if (P2point == 1) - P2res = "Fifteen"; - if (P2point == 2) - P2res = "Thirty"; - if (P2point == 3) - P2res = "Forty"; - - P1res = "Love"; - score = P1res + "-" + P2res; - } - - if (P1point > P2point && P1point < 4) { - if (P1point == 2) - P1res = "Thirty"; - if (P1point == 3) - P1res = "Forty"; - if (P2point == 1) - P2res = "Fifteen"; - if (P2point == 2) - P2res = "Thirty"; - score = P1res + "-" + P2res; - } - if (P2point > P1point && P2point < 4) { - if (P2point == 2) - P2res = "Thirty"; - if (P2point == 3) - P2res = "Forty"; - if (P1point == 1) - P1res = "Fifteen"; - if (P1point == 2) - P1res = "Thirty"; - score = P1res + "-" + P2res; - } - - if (P1point > P2point && P2point >= 3) { - score = "Advantage player1"; - } - - if (P2point > P1point && P1point >= 3) { - score = "Advantage player2"; - } - - if (P1point >= 4 && P2point >= 0 && (P1point - P2point) >= 2) { - score = "Win for player1"; - } - if (P2point >= 4 && P1point >= 0 && (P2point - P1point) >= 2) { - score = "Win for player2"; - } - return score; + public int P1point = 0; + public int P2point = 0; + + public String P1res = ""; + public String P2res = ""; + private String player1Name; + private String player2Name; + + public TennisGame2(String player1Name, String player2Name) { + this.player1Name = player1Name; + this.player2Name = player2Name; + } + + public String score() { + String score = ""; + if (P1point == P2point && P1point < 4) { + if (P1point == 0) score = "Love"; + if (P1point == 1) score = "Fifteen"; + if (P1point == 2) score = "Thirty"; + score += "-All"; } + if (P1point == P2point && P1point >= 3) score = "Deuce"; - public void SetP1Score(int number) { + if (P1point > 0 && P2point == 0) { + if (P1point == 1) P1res = "Fifteen"; + if (P1point == 2) P1res = "Thirty"; + if (P1point == 3) P1res = "Forty"; - for (int i = 0; i < number; i++) { - P1Score(); - } + P2res = "Love"; + score = P1res + "-" + P2res; + } + if (P2point > 0 && P1point == 0) { + if (P2point == 1) P2res = "Fifteen"; + if (P2point == 2) P2res = "Thirty"; + if (P2point == 3) P2res = "Forty"; + P1res = "Love"; + score = P1res + "-" + P2res; } - public void SetP2Score(int number) { + if (P1point > P2point && P1point < 4) { + if (P1point == 2) P1res = "Thirty"; + if (P1point == 3) P1res = "Forty"; + if (P2point == 1) P2res = "Fifteen"; + if (P2point == 2) P2res = "Thirty"; + score = P1res + "-" + P2res; + } + if (P2point > P1point && P2point < 4) { + if (P2point == 2) P2res = "Thirty"; + if (P2point == 3) P2res = "Forty"; + if (P1point == 1) P1res = "Fifteen"; + if (P1point == 2) P1res = "Thirty"; + score = P1res + "-" + P2res; + } - for (int i = 0; i < number; i++) { - P2Score(); - } + if (P1point > P2point && P2point >= 3) { + score = "Advantage player1"; + } + if (P2point > P1point && P1point >= 3) { + score = "Advantage player2"; } - public void P1Score() { - P1point++; + if (P1point >= 4 && P2point >= 0 && (P1point - P2point) >= 2) { + score = "Win for player1"; + } + if (P2point >= 4 && P1point >= 0 && (P2point - P1point) >= 2) { + score = "Win for player2"; } + return score; + } - public void P2Score() { - P2point++; + public void SetP1Score(int number) { + for (int i = 0; i < number; i++) { + P1Score(); } + } - public void wonPoint(String player) { - if (player == "player1") - P1Score(); - else - P2Score(); + public void SetP2Score(int number) { + for (int i = 0; i < number; i++) { + P2Score(); } + } + + public void P1Score() { + P1point++; + } + + public void P2Score() { + P2point++; + } + + public void wonPoint(String player) { + if (player == "player1") P1Score(); else P2Score(); + } } diff --git a/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame3.java b/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame3.java index 0465a5336f05007c7c651e66b71ebc9f749cc60b..02a1ac414b7792df7cbb945520a962c245462c01 100644 --- a/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame3.java +++ b/tennis/refactoring/src/main/java/fr/ippon/kata/TennisGame3.java @@ -1,38 +1,31 @@ package fr.ippon.kata; - public class TennisGame3 implements TennisGame { - private int p2; - private int p1; - private String p1N; - private String p2N; - - public TennisGame3(String p1N, String p2N) { - this.p1N = p1N; - this.p2N = p2N; - } - - public String score() { - String s; - if (p1 < 4 && p2 < 4 && !(p1 + p2 == 6)) { - String[] p = new String[]{"Love", "Fifteen", "Thirty", "Forty"}; - s = p[p1]; - return (p1 == p2) ? s + "-All" : s + "-" + p[p2]; - } else { - if (p1 == p2) - return "Deuce"; - s = p1 > p2 ? p1N : p2N; - return ((p1 - p2) * (p1 - p2) == 1) ? "Advantage " + s : "Win for " + s; - } - } - - public void wonPoint(String playerName) { - if (playerName == "player1") - this.p1 += 1; - else - this.p2 += 1; - + private int p2; + private int p1; + private String p1N; + private String p2N; + + public TennisGame3(String p1N, String p2N) { + this.p1N = p1N; + this.p2N = p2N; + } + + public String score() { + String s; + if (p1 < 4 && p2 < 4 && !(p1 + p2 == 6)) { + String[] p = new String[] { "Love", "Fifteen", "Thirty", "Forty" }; + s = p[p1]; + return (p1 == p2) ? s + "-All" : s + "-" + p[p2]; + } else { + if (p1 == p2) return "Deuce"; + s = p1 > p2 ? p1N : p2N; + return ((p1 - p2) * (p1 - p2) == 1) ? "Advantage " + s : "Win for " + s; } + } + public void wonPoint(String playerName) { + if (playerName == "player1") this.p1 += 1; else this.p2 += 1; + } } diff --git a/tennis/refactoring/src/test/java/fr/ippon/kata/TennisGameUnitTest.java b/tennis/refactoring/src/test/java/fr/ippon/kata/TennisGameUnitTest.java index d9d425e18e9da8e67853f71f46274c44c3f344d7..38810a44781f51cfcdfbe5f9bbc7a809f9cae827 100644 --- a/tennis/refactoring/src/test/java/fr/ippon/kata/TennisGameUnitTest.java +++ b/tennis/refactoring/src/test/java/fr/ippon/kata/TennisGameUnitTest.java @@ -1,64 +1,62 @@ package fr.ippon.kata; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvFileSource; -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - public class TennisGameUnitTest { - @ParameterizedTest - @CsvFileSource(delimiter = ',', numLinesToSkip = 1, resources = "/param-test-data.csv") - void checkAllScoresTennisGame1(Integer player1Score, Integer player2Score, String expectedScore) { - TennisGame1 game = new TennisGame1("player1", "player2"); - checkAllScores(player1Score, player2Score, expectedScore, game); - } - - @Test - void checkForRealPlayerNames() { - String benoit_paire = "Benoit Paire"; - String roger_federer = "Roger Federer"; - - TennisGame1 game = new TennisGame1(benoit_paire, roger_federer); - - game.wonPoint(benoit_paire); - game.wonPoint(benoit_paire); - game.wonPoint(benoit_paire); - game.wonPoint(roger_federer); - game.wonPoint(roger_federer); - game.wonPoint(roger_federer); - game.wonPoint(roger_federer); - game.wonPoint(benoit_paire); - game.wonPoint(benoit_paire); - - assertThat(game.score()).isEqualTo("Advantage Benoit Paire"); - } - - @ParameterizedTest - @CsvFileSource(delimiter = ',', numLinesToSkip = 1, resources = "/param-test-data.csv") - void checkAllScoresTennisGame2(Integer player1Score, Integer player2Score, String expectedScore) { - TennisGame2 game = new TennisGame2("player1", "player2"); - checkAllScores(player1Score, player2Score, expectedScore, game); - } - - @ParameterizedTest - @CsvFileSource(delimiter = ',', numLinesToSkip = 1, resources = "/param-test-data.csv") - void checkAllScoresTennisGame3(Integer player1Score, Integer player2Score, String expectedScore) { - TennisGame3 game = new TennisGame3("player1", "player2"); - checkAllScores(player1Score, player2Score, expectedScore, game); + @ParameterizedTest + @CsvFileSource(delimiter = ',', numLinesToSkip = 1, resources = "/param-test-data.csv") + void checkAllScoresTennisGame1(Integer player1Score, Integer player2Score, String expectedScore) { + TennisGame1 game = new TennisGame1("player1", "player2"); + checkAllScores(player1Score, player2Score, expectedScore, game); + } + + @Test + void checkForRealPlayerNames() { + String benoit_paire = "Benoit Paire"; + String roger_federer = "Roger Federer"; + + TennisGame1 game = new TennisGame1(benoit_paire, roger_federer); + + game.wonPoint(benoit_paire); + game.wonPoint(benoit_paire); + game.wonPoint(benoit_paire); + game.wonPoint(roger_federer); + game.wonPoint(roger_federer); + game.wonPoint(roger_federer); + game.wonPoint(roger_federer); + game.wonPoint(benoit_paire); + game.wonPoint(benoit_paire); + + assertThat(game.score()).isEqualTo("Advantage Benoit Paire"); + } + + @ParameterizedTest + @CsvFileSource(delimiter = ',', numLinesToSkip = 1, resources = "/param-test-data.csv") + void checkAllScoresTennisGame2(Integer player1Score, Integer player2Score, String expectedScore) { + TennisGame2 game = new TennisGame2("player1", "player2"); + checkAllScores(player1Score, player2Score, expectedScore, game); + } + + @ParameterizedTest + @CsvFileSource(delimiter = ',', numLinesToSkip = 1, resources = "/param-test-data.csv") + void checkAllScoresTennisGame3(Integer player1Score, Integer player2Score, String expectedScore) { + TennisGame3 game = new TennisGame3("player1", "player2"); + checkAllScores(player1Score, player2Score, expectedScore, game); + } + + private void checkAllScores(Integer player1Score, Integer player2Score, String expectedScore, TennisGame game) { + int highestScore = Math.max(player1Score, player2Score); + + for (int i = 0; i < highestScore; i++) { + if (i < player1Score) game.wonPoint("player1"); + if (i < player2Score) game.wonPoint("player2"); } - private void checkAllScores(Integer player1Score, Integer player2Score, String expectedScore, TennisGame game) { - int highestScore = Math.max(player1Score, player2Score); - - for (int i = 0; i < highestScore; i++) { - if (i < player1Score) - game.wonPoint("player1"); - if (i < player2Score) - game.wonPoint("player2"); - } - - assertThat(game.score()).isEqualTo(expectedScore); - } + assertThat(game.score()).isEqualTo(expectedScore); + } } diff --git a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/TripService_Original.java b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/TripService_Original.java index a2ba5ee3c2090f4144e631dd8d83ef1b512dd0fe..8dde3037f1bbaf9806292ed6c8532b1882143439 100644 --- a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/TripService_Original.java +++ b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/TripService_Original.java @@ -2,7 +2,6 @@ package org.craftedsw.tripservicekata; import java.util.ArrayList; import java.util.List; - import org.craftedsw.tripservicekata.exception.UserNotLoggedInException; import org.craftedsw.tripservicekata.trip.Trip; import org.craftedsw.tripservicekata.trip.TripDAO; @@ -11,24 +10,23 @@ import org.craftedsw.tripservicekata.user.UserSession; public class TripService_Original { - public List<Trip> getTripsByUser(User user) throws UserNotLoggedInException { - List<Trip> tripList = new ArrayList<Trip>(); - User loggedUser = UserSession.getInstance().getLoggedUser(); - boolean isFriend = false; - if (loggedUser != null) { - for (User friend : user.getFriends()) { - if (friend.equals(loggedUser)) { - isFriend = true; - break; - } - } - if (isFriend) { - tripList = TripDAO.findTripsByUser(user); - } - return tripList; - } else { - throw new UserNotLoggedInException(); - } - } - + public List<Trip> getTripsByUser(User user) throws UserNotLoggedInException { + List<Trip> tripList = new ArrayList<Trip>(); + User loggedUser = UserSession.getInstance().getLoggedUser(); + boolean isFriend = false; + if (loggedUser != null) { + for (User friend : user.getFriends()) { + if (friend.equals(loggedUser)) { + isFriend = true; + break; + } + } + if (isFriend) { + tripList = TripDAO.findTripsByUser(user); + } + return tripList; + } else { + throw new UserNotLoggedInException(); + } + } } diff --git a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/exception/CollaboratorCallException.java b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/exception/CollaboratorCallException.java index 828353e7da1ceee8e506e1e3cd2768d37c89bd83..756411237d3364500a62864f2ed9495c77ec7a59 100644 --- a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/exception/CollaboratorCallException.java +++ b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/exception/CollaboratorCallException.java @@ -2,24 +2,21 @@ package org.craftedsw.tripservicekata.exception; public class CollaboratorCallException extends RuntimeException { - private static final long serialVersionUID = -4584041339906109902L; + private static final long serialVersionUID = -4584041339906109902L; - public CollaboratorCallException() { - super(); - } + public CollaboratorCallException() { + super(); + } - public CollaboratorCallException(String message, - Throwable cause) { - super(message, cause); - } + public CollaboratorCallException(String message, Throwable cause) { + super(message, cause); + } - public CollaboratorCallException(String message) { - super(message); - } + public CollaboratorCallException(String message) { + super(message); + } - public CollaboratorCallException(Throwable cause) { - super(cause); - } - - + public CollaboratorCallException(Throwable cause) { + super(cause); + } } diff --git a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/exception/UserNotLoggedInException.java b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/exception/UserNotLoggedInException.java index 880bf2041e5d18c92a58447891c69e2c09b4332b..d7ffd0ff24e08c12c29af71d8aeb9602594cec14 100644 --- a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/exception/UserNotLoggedInException.java +++ b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/exception/UserNotLoggedInException.java @@ -2,6 +2,5 @@ package org.craftedsw.tripservicekata.exception; public class UserNotLoggedInException extends RuntimeException { - private static final long serialVersionUID = 8959479918185637340L; - + private static final long serialVersionUID = 8959479918185637340L; } diff --git a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/trip/Trip.java b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/trip/Trip.java index f12ff3cc1e04fe37585e6f1e66cb32fe56f1b671..e54e925fe7ca6f196cb78be287a514e5ab67d8a5 100644 --- a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/trip/Trip.java +++ b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/trip/Trip.java @@ -1,5 +1,3 @@ package org.craftedsw.tripservicekata.trip; -public class Trip { - -} +public class Trip {} diff --git a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/trip/TripService.java b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/trip/TripService.java index 00ea28839617bcfa939a4a015b61e616ef39d500..3c6847eaba01807137b0558c0ff3d7461152ff1c 100644 --- a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/trip/TripService.java +++ b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/trip/TripService.java @@ -6,6 +6,7 @@ import org.craftedsw.tripservicekata.user.User; import org.craftedsw.tripservicekata.user.UserSession; public class TripService { + private final UserSession userSession; private final Trips trips; diff --git a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/user/User.java b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/user/User.java index cafaa2002326d83f4052f4e8776907299ac58b04..fb98737b0887b9f1b68763e78758103596742597 100644 --- a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/user/User.java +++ b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/user/User.java @@ -2,28 +2,26 @@ package org.craftedsw.tripservicekata.user; import java.util.ArrayList; import java.util.List; - import org.craftedsw.tripservicekata.trip.Trip; public class User { - private List<Trip> trips = new ArrayList<Trip>(); - private List<User> friends = new ArrayList<User>(); - - public List<User> getFriends() { - return friends; - } - - public void addFriend(User user) { - friends.add(user); - } + private List<Trip> trips = new ArrayList<Trip>(); + private List<User> friends = new ArrayList<User>(); + + public List<User> getFriends() { + return friends; + } + + public void addFriend(User user) { + friends.add(user); + } - public void addTrip(Trip trip) { - trips.add(trip); - } - - public List<Trip> trips() { - return trips; - } + public void addTrip(Trip trip) { + trips.add(trip); + } + public List<Trip> trips() { + return trips; + } } diff --git a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/user/UserSession.java b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/user/UserSession.java index 6b91c0d86ef6e8ca6ad541010ce0816eaf9528de..d1df9d2a0d4e5610242d0e57654fe6d6b1dbf33e 100644 --- a/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/user/UserSession.java +++ b/trip-service-kata/src/main/java/org/craftedsw/tripservicekata/user/UserSession.java @@ -4,18 +4,15 @@ import org.craftedsw.tripservicekata.exception.CollaboratorCallException; public class UserSession { - private static final UserSession userSession = new UserSession(); - - private UserSession() { - } - - public static UserSession getInstance() { - return userSession; - } + private static final UserSession userSession = new UserSession(); - public User getLoggedUser() { - throw new CollaboratorCallException( - "UserSession.getLoggedUser() should not be called in an unit test"); - } + private UserSession() {} + public static UserSession getInstance() { + return userSession; + } + + public User getLoggedUser() { + throw new CollaboratorCallException("UserSession.getLoggedUser() should not be called in an unit test"); + } } diff --git a/trip-service-kata/src/test/java/org/craftedsw/tripservicekata/trip/TripServiceTest.java b/trip-service-kata/src/test/java/org/craftedsw/tripservicekata/trip/TripServiceTest.java index f22c19907cc874638a191d099253a5c63f4ae43e..c4d0c92ccee9cf29469123a814ac6c953a249395 100644 --- a/trip-service-kata/src/test/java/org/craftedsw/tripservicekata/trip/TripServiceTest.java +++ b/trip-service-kata/src/test/java/org/craftedsw/tripservicekata/trip/TripServiceTest.java @@ -17,6 +17,7 @@ import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) class TripServiceTest { + private final User authenticatedUser = new User(); private final User friend = new User(); diff --git a/try-monade/src/main/java/fr/ippon/craft/Try.java b/try-monade/src/main/java/fr/ippon/craft/Try.java index f051986e01a27d51ea704af2441a2226ad1e4fc0..9ca3f790deece3c36e8982adfb69ac6002e35d31 100644 --- a/try-monade/src/main/java/fr/ippon/craft/Try.java +++ b/try-monade/src/main/java/fr/ippon/craft/Try.java @@ -26,6 +26,7 @@ public abstract class Try<T> { public abstract T orElseGet(Faillable<T> failing); private static class SuccessfulTry<T> extends Try<T> { + private final T result; private SuccessfulTry(T result) { @@ -61,6 +62,7 @@ public abstract class Try<T> { } private static class FailingTry<T> extends Try<T> { + private final Throwable e; private FailingTry(Throwable e) { diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Answer.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Answer.java index 370117a703d81dad269fe6585be7cbaf93ae8e0d..62aaef2e166bad010b85dcbfe507314842a650fc 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Answer.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Answer.java @@ -1,6 +1,7 @@ package com.adaptionsoft.games.uglytrivia; public class Answer { + private final Notifications notifications; private final AnswerRandomSimulator answerRandom; diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/AnswerRandomSimulator.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/AnswerRandomSimulator.java index 983c1f2deb18abb41a13bbc06e159a4209544f10..a7b1333bfb14c9d0765ef6bc93f2669a9c7c4c72 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/AnswerRandomSimulator.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/AnswerRandomSimulator.java @@ -3,6 +3,7 @@ package com.adaptionsoft.games.uglytrivia; import java.util.Random; class AnswerRandomSimulator { + private final Random rand; AnswerRandomSimulator(Random rand) { diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Board.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Board.java index ffd3ec1dcca9dec282002cd11c849ab71cf6d2fd..624654514af74359268428e7fc61f74e66cb6b84 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Board.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Board.java @@ -1,6 +1,7 @@ package com.adaptionsoft.games.uglytrivia; class Board { + private final int limitBoardSize; Board(int limitBoardSize) { diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Category.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Category.java index 7193552bcfd6d8d43f29a9f5a00de3d35482d875..5603d9632c71b7d010dcf489ef62edf1c5d5c0ab 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Category.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Category.java @@ -8,6 +8,7 @@ enum Category { SCIENCE("Science", List.of(1, 5, 9)), SPORTS("Sports", List.of(2, 6, 10)), ROCK("Rock", List.of()); + private final String category; private final List<Integer> positions; diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/ConsolePrinter.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/ConsolePrinter.java index ea4299587c73eb442291c00e6edb5f5e75e671b6..bdbad40e091e7c7a8445ebaa0b0986b6a4ebbbe8 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/ConsolePrinter.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/ConsolePrinter.java @@ -3,6 +3,7 @@ package com.adaptionsoft.games.uglytrivia; import java.io.PrintStream; class ConsolePrinter { + private final PrintStream print; public ConsolePrinter(PrintStream print) { diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Deck.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Deck.java index dc63b4a3ae7f11ccd268fc182f2a3e5ca0611c44..5eef35c3d4c5174ed49e563d94b842d77b63c382 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Deck.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Deck.java @@ -5,6 +5,7 @@ import java.util.LinkedList; import java.util.Map; class Deck { + Map<Category, LinkedList<Question>> deck; Deck(int limitDeckSize) { diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Dice.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Dice.java index 9a58ff540f0cd2a50ad64215a07b7abda46a313f..2e359b8b5afed53e53864b1772becccdc4cd4a61 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Dice.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Dice.java @@ -3,6 +3,7 @@ package com.adaptionsoft.games.uglytrivia; import java.util.Random; class Dice { + private final Random rand; public Dice(Random rand) { diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Game.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Game.java index 5e6c34513d43508a8112af9f3e790ee34c40d45c..a66debeb5ac209e89c2c66beb93b733bd2ffc35e 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Game.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Game.java @@ -1,6 +1,7 @@ package com.adaptionsoft.games.uglytrivia; class Game { + static final int MAX_PLAYER_PLAYABLE = 6; static final int MAX_GOLD_COINS = 6; static final int MIN_PLAYER_PLAYABLE = 2; diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Notifications.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Notifications.java index 25d123e1088f6dd6426c39d220e0598140d66d68..96ff7b4a08b995e1d232e3edf5de02196793fcf3 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Notifications.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Notifications.java @@ -1,6 +1,7 @@ package com.adaptionsoft.games.uglytrivia; class Notifications { + private final ConsolePrinter printer; public Notifications(ConsolePrinter printer) { diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Player.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Player.java index 95bcbaae85a2ed0163aad1db00d2986cd5ef36a8..96b8f4607feb1716686a49e8eb75a763b6f3ed90 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Player.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Player.java @@ -4,6 +4,7 @@ import java.util.Optional; import org.apache.maven.surefire.shade.booter.org.apache.commons.lang3.builder.HashCodeBuilder; class Player { + private final String name; private final int position; private final int purse; @@ -79,6 +80,7 @@ class Player { } private static class PlayerBuilder { + private String name; private int position; private int purse; diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Players.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Players.java index dcfc1b932ef4f56da6a82444dce8be53fb96cdf7..dd19d9c68fda2caf771d08ac3313f86316eeb7b9 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Players.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Players.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.stream.Collectors; class Players { + private final List<Player> players; private int currentPlayer; diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Question.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Question.java index e8d974fd04c3d894d29ba3d12d2c06a586cc2f1a..1ea72ca4624d008cba5d0989b6188406f7a45ffb 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Question.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Question.java @@ -1,6 +1,7 @@ package com.adaptionsoft.games.uglytrivia; class Question { + private final String message; Question(Category category, int index) { diff --git a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Turn.java b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Turn.java index 6d17ec766f517c37c878f24cc61163fd1950bb2b..199fae40233a3df28a07504471c667c701b5e3be 100755 --- a/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Turn.java +++ b/ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Turn.java @@ -1,6 +1,7 @@ package com.adaptionsoft.games.uglytrivia; class Turn { + private final Notifications notifications; private final Board board; private final Dice dice; diff --git a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/AnswerRandomSimulatorUnitTest.java b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/AnswerRandomSimulatorUnitTest.java index 2366134d5663b5f00cf427c7d05cce9f54bdc48a..2e3b0e0bcabc6cc27cf23cfe3647c1ecb360fb17 100755 --- a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/AnswerRandomSimulatorUnitTest.java +++ b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/AnswerRandomSimulatorUnitTest.java @@ -7,6 +7,7 @@ import java.util.Random; import org.junit.jupiter.api.Test; public class AnswerRandomSimulatorUnitTest { + Random rand = mock(Random.class); @Test diff --git a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/AnswerUnitTest.java b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/AnswerUnitTest.java index 164d96d276eb1dd14027ef386d77a0e2e4a3cbdf..e691c4ac2378103ab87b7ea69b7a742196e46b9e 100755 --- a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/AnswerUnitTest.java +++ b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/AnswerUnitTest.java @@ -6,6 +6,7 @@ import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; class AnswerUnitTest { + private final Notifications notifications = mock(Notifications.class); private final AnswerRandomSimulator randomSimulator = mock(AnswerRandomSimulator.class); diff --git a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/BoardUnitTest.java b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/BoardUnitTest.java index 07480bc3057c52bf251e7c42ce4cbf7e0ef042bc..daab61a2830148e24630755a5664fca37b2f8c03 100755 --- a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/BoardUnitTest.java +++ b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/BoardUnitTest.java @@ -5,6 +5,7 @@ import static org.assertj.core.api.Assertions.*; import org.junit.jupiter.api.Test; class BoardUnitTest { + static final int BOARD_LIMIT = 10; private final Board board = new Board(BOARD_LIMIT); diff --git a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/ConsolePrinterUnitTest.java b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/ConsolePrinterUnitTest.java index 8d1ad6733b3d4d51c8b7dac10123147c0e9fb391..359e5102e6b3615a857fbd6fed1d0f4670fde358 100644 --- a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/ConsolePrinterUnitTest.java +++ b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/ConsolePrinterUnitTest.java @@ -8,6 +8,7 @@ import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; class ConsolePrinterUnitTest { + PrintStream print = mock(PrintStream.class); @Test diff --git a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/DiceUnitTest.java b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/DiceUnitTest.java index 4a59ffd7f0c390940260e4dfb64db6598b170221..1f1ae346f60380f7889e0c7781053d5b95e4eaf2 100755 --- a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/DiceUnitTest.java +++ b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/DiceUnitTest.java @@ -7,6 +7,7 @@ import java.util.Random; import org.junit.jupiter.api.Test; class DiceUnitTest { + Random rand = mock(Random.class); @Test diff --git a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/GameUnitTest.java b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/GameUnitTest.java index 865957feaf8b634a06238ad911a6759a7c2473b1..386e90191a1994541820b7ce0b55fbf4ae664091 100755 --- a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/GameUnitTest.java +++ b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/GameUnitTest.java @@ -8,6 +8,7 @@ import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; public class GameUnitTest { + public static final String JULIE = "JULIE"; private static final String JADE = "JADE"; private static final String MORGANA = "Morgana"; diff --git a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/NotificationsUnitTest.java b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/NotificationsUnitTest.java index 732d673260a2e44286bd919672c91235f0270afb..aea9d1aadde6879fa2c91c1c4f80c7c7b384ede7 100755 --- a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/NotificationsUnitTest.java +++ b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/NotificationsUnitTest.java @@ -5,6 +5,7 @@ import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; class NotificationsUnitTest { + private static final String JULIE = "Julie"; private final ConsolePrinter printer = mock(ConsolePrinter.class); private final Notifications notifications = new Notifications(printer); diff --git a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/PlayerUnitTest.java b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/PlayerUnitTest.java index cb28411772afd75bb1c8cbdf16e20b7d968387ce..409f1f8e93ce0bc5ab39cd00276fab65fff2e3ff 100755 --- a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/PlayerUnitTest.java +++ b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/PlayerUnitTest.java @@ -5,6 +5,7 @@ import static org.assertj.core.api.Assertions.*; import org.junit.jupiter.api.Test; public class PlayerUnitTest { + private static final String JULIE = "Julie"; private static final String PLAYER = "Player"; private static final String JADE = "Jade"; diff --git a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/PlayersUnitTest.java b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/PlayersUnitTest.java index 2b44ec324eb510ae4361d7ce5aad2c1e0da5c7ed..c8a14fd193733522dfb1dd5de11998eba311555c 100755 --- a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/PlayersUnitTest.java +++ b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/PlayersUnitTest.java @@ -5,6 +5,7 @@ import static org.assertj.core.api.Assertions.*; import org.junit.jupiter.api.Test; class PlayersUnitTest { + static final String PLAYER_NAME = "Julie"; private static final String JADE = "Jade"; diff --git a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/TurnUnitTest.java b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/TurnUnitTest.java index a1635fbf54f5c426b14c650f468bd8df18b99ddc..e40b635e86fae7e8e38ceb45f3095ed002dddb3f 100755 --- a/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/TurnUnitTest.java +++ b/ugly-trivia/src/test/java/com/adaptionsoft/games/uglytrivia/TurnUnitTest.java @@ -6,6 +6,7 @@ import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; public class TurnUnitTest { + static final int BOARD_LIMIT = 12; public static final String PLAYER_NAME = "Julie"; diff --git a/word-wrap/src/main/java/fr/ippon/kata/wrapper/Wrapper.java b/word-wrap/src/main/java/fr/ippon/kata/wrapper/Wrapper.java index 3e03b9cdcab02dec6bf074c9921e507c19259337..e3e2ce77c990916b56d360f717ef535f64ab701b 100644 --- a/word-wrap/src/main/java/fr/ippon/kata/wrapper/Wrapper.java +++ b/word-wrap/src/main/java/fr/ippon/kata/wrapper/Wrapper.java @@ -1,6 +1,7 @@ package fr.ippon.kata.wrapper; public class Wrapper { + private static final String SPACE = " "; private static final String BREAK = "\n"; private int columns;