Fixed most reported issues by SonarCloud.
This commit is contained in:
@ -37,19 +37,22 @@ package com.iluwatar.servicelocator;
|
||||
*/
|
||||
public class App {
|
||||
|
||||
public static final String JNDI_SERVICE_A = "jndi/serviceA";
|
||||
public static final String JNDI_SERVICE_B = "jndi/serviceB";
|
||||
|
||||
/**
|
||||
* Program entry point.
|
||||
*
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
var service = ServiceLocator.getService("jndi/serviceA");
|
||||
var service = ServiceLocator.getService(JNDI_SERVICE_A);
|
||||
service.execute();
|
||||
service = ServiceLocator.getService("jndi/serviceB");
|
||||
service = ServiceLocator.getService(JNDI_SERVICE_B);
|
||||
service.execute();
|
||||
service = ServiceLocator.getService("jndi/serviceA");
|
||||
service = ServiceLocator.getService(JNDI_SERVICE_A);
|
||||
service.execute();
|
||||
service = ServiceLocator.getService("jndi/serviceA");
|
||||
service = ServiceLocator.getService(JNDI_SERVICE_A);
|
||||
service.execute();
|
||||
}
|
||||
}
|
||||
|
@ -25,13 +25,15 @@ package com.iluwatar.servicelocator;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
/**
|
||||
* Application test
|
||||
*/
|
||||
public class AppTest {
|
||||
class AppTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
App.main(new String[]{});
|
||||
void shouldExecuteWithoutException() {
|
||||
assertDoesNotThrow(() -> App.main(new String[]{}));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user