📍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

@ -23,8 +23,7 @@
package com.iluwatar.servicelocator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* For JNDI lookup of services from the web.xml. Will match name of the service name that is being
@ -32,10 +31,9 @@ import org.slf4j.LoggerFactory;
*
* @author saifasif
*/
@Slf4j
public class InitContext {
private static final Logger LOGGER = LoggerFactory.getLogger(InitContext.class);
/**
* Perform the lookup based on the service name. The returned object will need to be casted into a
* {@link Service}

View File

@ -25,8 +25,7 @@ package com.iluwatar.servicelocator;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* The service cache implementation which will cache services that are being created. On first hit,
@ -36,10 +35,9 @@ import org.slf4j.LoggerFactory;
*
* @author saifasif
*/
@Slf4j
public class ServiceCache {
private static final Logger LOGGER = LoggerFactory.getLogger(ServiceCache.class);
private final Map<String, Service> serviceCache;
public ServiceCache() {

View File

@ -23,8 +23,7 @@
package com.iluwatar.servicelocator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* This is a single service implementation of a sample service. This is the actual service that will
@ -33,10 +32,9 @@ import org.slf4j.LoggerFactory;
*
* @author saifasif
*/
@Slf4j
public class ServiceImpl implements Service {
private static final Logger LOGGER = LoggerFactory.getLogger(ServiceImpl.class);
private final String serviceName;
private final int id;

View File

@ -37,13 +37,13 @@ import org.junit.jupiter.api.Test;
*
* @author Jeroen Meulemeester
*/
public class ServiceLocatorTest {
class ServiceLocatorTest {
/**
* Verify if we just receive 'null' when requesting a non-existing service
*/
@Test
public void testGetNonExistentService() {
void testGetNonExistentService() {
assertNull(ServiceLocator.getService("fantastic/unicorn/service"));
assertNull(ServiceLocator.getService("another/fantastic/unicorn/service"));
}
@ -52,7 +52,7 @@ public class ServiceLocatorTest {
* Verify if we get the same cached instance when requesting the same service twice
*/
@Test
public void testServiceCache() {
void testServiceCache() {
final var serviceNames = List.of("jndi/serviceA", "jndi/serviceB");
for (final var serviceName : serviceNames) {