dependencies: #2449 bump maven-checkstyle-plugin from 3.1.0 to 3.2.0 + resolve chec… (#2464)

* #2449 bump maven-checkstyle-plugin from 3.1.0 to 3.2.0 + resolve checkstyle issues

* remove FileSelectorJFrame.java to resolve checkstyle issue

* remove FileSelectorJFrame.java to resolve checkstyle issue

* remove FileSelectorJFrame.java to resolve checkstyle issue

* add refactored file with correct filename to resolve checkstyle issue

* add the test data

* change filenames from JFrame to Jframe for checkstyle

* fix code smell from  sonar report

* add new testcases to improve the test coverage

* remove code smell
This commit is contained in:
Rahul Raj
2023-02-04 22:50:54 +05:30
committed by GitHub
parent dbecffacab
commit fb7ec9b375
147 changed files with 487 additions and 289 deletions
@@ -24,6 +24,9 @@
*/
package com.iluwatar.identitymap;
/**
* Using Runtime Exception to control the flow in case Person Id doesn not exist.
*/
public class IdNotFoundException extends RuntimeException {
public IdNotFoundException(final String message) {
super(message);
@@ -26,7 +26,6 @@ package com.iluwatar.identitymap;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
@@ -25,7 +25,6 @@
package com.iluwatar.identitymap;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@@ -24,13 +24,16 @@
*/
package com.iluwatar.identitymap;
/**
* Simulator interface for Person DB.
*/
public interface PersonDbSimulator {
Person find(int personNationalID);
Person find(int personNationalId);
void insert(Person person);
void update(Person person);
void delete(int personNationalID);
void delete(int personNationalId);
}
@@ -27,7 +27,6 @@ package com.iluwatar.identitymap;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
/**
@@ -49,10 +48,10 @@ public class PersonDbSimulatorImplementation implements PersonDbSimulator {
static final String ID_STR = "ID : ";
@Override
public Person find(int personNationalID) throws IdNotFoundException {
Optional<Person> elem = personList.stream().filter(p -> p.getPersonNationalId() == personNationalID).findFirst();
public Person find(int personNationalId) throws IdNotFoundException {
Optional<Person> elem = personList.stream().filter(p -> p.getPersonNationalId() == personNationalId).findFirst();
if (elem.isEmpty()) {
throw new IdNotFoundException(ID_STR + personNationalID + NOT_IN_DATA_BASE);
throw new IdNotFoundException(ID_STR + personNationalId + NOT_IN_DATA_BASE);
}
LOGGER.info(elem.get().toString());
return elem.get();