JAVA-13721 Further formatting of files

This commit is contained in:
Dhawal Kapil 2023-05-16 23:06:58 +05:30
parent 7b8fad5dc9
commit 585d1e1575
8 changed files with 27 additions and 24 deletions

View File

@ -1,7 +1,5 @@
package com.baeldung.mockito.argumentcaptor;
public enum AuthenticationStatus {
AUTHENTICATED,
NOT_AUTHENTICATED,
ERROR
AUTHENTICATED, NOT_AUTHENTICATED, ERROR
}

View File

@ -1,7 +1,5 @@
package com.baeldung.mockito.argumentcaptor;
public enum ServiceStatus {
UP,
DOWN,
AUTHENTICATED
UP, DOWN, AUTHENTICATED
}

View File

@ -11,15 +11,15 @@ public class FlowerService {
private List<String> flowers = Arrays.asList("Poppy", "Ageratum", "Carnation", "Diascia", "Lantana");
public String analyze(String name) {
if(flowers.contains(name)) {
if (flowers.contains(name)) {
return "flower";
}
return null;
}
public boolean isABigFlower(String name, int petals) {
if(flowers.contains(name)) {
if(petals > 10) {
if (flowers.contains(name)) {
if (petals > 10) {
return true;
}
}

View File

@ -17,18 +17,23 @@ public class User {
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}

View File

@ -5,6 +5,7 @@ import com.baeldung.mockito.junit5.User;
public interface UserRepository {
User insert(User user);
boolean isUsernameAlreadyExists(String userName);
}

View File

@ -26,19 +26,20 @@ public class DefaultUserService implements UserService {
}
private void validate(User user) {
if(user.getName() == null) {
if (user.getName() == null) {
throw new RuntimeException(Errors.USER_NAME_REQUIRED);
}
if(user.getName().length() < settingRepository.getUserNameMinLength()) {
if (user.getName()
.length() < settingRepository.getUserNameMinLength()) {
throw new RuntimeException(Errors.USER_NAME_SHORT);
}
if(user.getAge() < settingRepository.getUserMinAge()) {
if (user.getAge() < settingRepository.getUserMinAge()) {
throw new RuntimeException(Errors.USER_AGE_YOUNG);
}
if(userRepository.isUsernameAlreadyExists(user.getName())) {
if (userRepository.isUsernameAlreadyExists(user.getName())) {
throw new RuntimeException(Errors.USER_NAME_DUPLICATE);
}
}