📍Use lombok, reformat, and optimize the code (#1560)

* Use lombok, reformat, and optimize the code

* Fix merge conflicts and some sonar issues

Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
va1m
2021-03-13 13:19:21 +01:00
committed by GitHub
parent 0e26a6adb5
commit 5cf2fe009b
681 changed files with 2472 additions and 4966 deletions

View File

@ -26,8 +26,7 @@ package com.iluwatar.monad;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.Predicate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* The Monad pattern defines a monad structure, that enables chaining operations in pipelines and
@ -44,10 +43,9 @@ import org.slf4j.LoggerFactory;
* <p>As a validation result {@link Validator#get()} either returns valid object
* or throws {@link IllegalStateException} with list of exceptions collected during validation.
*/
@Slf4j
public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
/**
* Program entry point.
*

View File

@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
public class AppTest {
@Test
public void testMain() {
void testMain() {
App.main(new String[]{});
}

View File

@ -35,7 +35,7 @@ import org.junit.jupiter.api.Test;
public class MonadTest {
@Test
public void testForInvalidName() {
void testForInvalidName() {
var tom = new User(null, 21, Sex.MALE, "tom@foo.bar");
assertThrows(
IllegalStateException.class,
@ -46,7 +46,7 @@ public class MonadTest {
}
@Test
public void testForInvalidAge() {
void testForInvalidAge() {
var john = new User("John", 17, Sex.MALE, "john@qwe.bar");
assertThrows(
IllegalStateException.class,
@ -58,7 +58,7 @@ public class MonadTest {
}
@Test
public void testForValid() {
void testForValid() {
var sarah = new User("Sarah", 42, Sex.FEMALE, "sarah@det.org");
var validated = Validator.of(sarah)
.validate(User::getName, Objects::nonNull, "name cannot be null")