Skip to content

Commit

Permalink
Code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
fugerit79 committed Apr 18, 2024
1 parent b10daa5 commit 22eaace
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import javax.xml.crypto.Data;
import java.io.IOException;
import java.io.InputStream;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
import lombok.extern.slf4j.Slf4j;
import org.fugerit.java.emp.sm.service.ServiceResponse;
import org.fugerit.java.emp.sm.service.ServiceResponseHelper;

@Slf4j
@Provider
public class GenericExceptionMapper implements ExceptionMapper<WebApplicationException> {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response;
import lombok.extern.slf4j.Slf4j;
import org.fugerit.java.emp.em.GenericExceptionMapper;
import org.fugerit.java.emp.ex.WAExHelper;
import org.fugerit.java.emp.sm.service.ServiceMessage;
import org.fugerit.java.emp.sm.service.ServiceResponse;
import org.fugerit.java.emp.sm.service.ServiceResponseHelper;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

@Slf4j
class TestGenericExceptionMapper {

private static final String TEST_MESSAGE = "test error";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import jakarta.ws.rs.core.Response;
import lombok.extern.slf4j.Slf4j;
import org.fugerit.java.emp.ex.WAExHelper;
import org.fugerit.java.emp.sm.service.ServiceMessage;
import org.fugerit.java.emp.sm.service.ServiceResponse;
import org.fugerit.java.emp.sm.service.ServiceResponseHelper;
import org.junit.jupiter.api.Assertions;
Expand Down
1 change: 0 additions & 1 deletion fj-service-helper-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
<dependency>
<groupId>org.mvnpm</groupId>
<artifactId>es-module-shims</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.fugerit.java</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package test.org.fugerit.java.simple.config.microprofile;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.config.ConfigValue;
import org.eclipse.microprofile.config.spi.ConfigBuilder;
import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
Expand All @@ -23,6 +22,7 @@
class TestConfigParamsMicroprofile {

@Test
@SuppressWarnings("unchecked")
void testConfigParamsMicroprofile() throws IOException {
Properties configProperties = new Properties();
try (InputStream is = new FileInputStream( "src/test/resources/testconfig.properties" ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.extern.slf4j.Slf4j;
import org.fugerit.java.core.function.SafeFunction;
import org.fugerit.java.core.lang.helpers.ClassHelper;

import java.lang.reflect.Constructor;

Expand All @@ -13,6 +12,7 @@ private SimpleConfigFacade() {}

public static <T extends SimpleConfigurable> T configure( String type, ConfigParams configParams ) {
try {
@SuppressWarnings("unchecked")
Class<T> c = (Class<T>) Class.forName( type );
return configure( c, configParams );
} catch ( ClassNotFoundException e ) {
Expand All @@ -26,7 +26,8 @@ public static <T extends SimpleConfigurable> T configure( Class<T> c, ConfigPara
log.info( "type : {}, configParams : {}", c.getCanonicalName(), configParams );
Constructor<?> constructor = c.getDeclaredConstructor();
log.info( "constructor : {}", constructor );
T res = (T) constructor.newInstance();
@SuppressWarnings("unchecked")
T res = (T) constructor.newInstance();
log.info( "res, call configure() : {}", res );
res.configure( configParams );
return res;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void testConfigParams() throws IOException {
Assertions.assertFalse( valueX.isPresent() );
// test null namepsace
ConfigParams configAlt = new ConfigParamsDefault( null, configProperties ).withInfoLog();
String value3 = config.getValue( "testconfig.param3" );
String value3 = configAlt.getValue( "testconfig.param3" );
Assertions.assertEquals( "value3", value3 );
// simple configuration
String typeOk = SimpleConfigurableObject.class.getName();
Expand Down

0 comments on commit 22eaace

Please sign in to comment.