📍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:
@ -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.
|
||||
*
|
||||
|
@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
public void testMain() {
|
||||
void testMain() {
|
||||
App.main(new String[]{});
|
||||
}
|
||||
|
||||
|
@ -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")
|
||||
|
Reference in New Issue
Block a user