BAEL-65 - moving from sout to logger

This commit is contained in:
Slavisa Baeldung 2016-07-07 15:42:13 +02:00
parent 5733676887
commit 30f00a34af
1 changed files with 83 additions and 85 deletions

View File

@ -14,6 +14,8 @@ import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ -26,6 +28,8 @@ import com.baeldung.spring.PersistenceConfig;
@ContextConfiguration(classes = {PersistenceConfig.class}, loader = AnnotationConfigContextLoader.class)
public class FooStoredProceduresIntegrationTest {
private static final Logger LOGGER = LoggerFactory.getLogger(FooStoredProceduresIntegrationTest.class);
@Autowired
private SessionFactory sessionFactory;
@ -48,8 +52,7 @@ public class FooStoredProceduresIntegrationTest {
sqlQuery.list();
return true;
} catch (SQLGrammarException e) {
System.out
.println("WARNING : GetFoosByName() Procedure is may be missing ");
LOGGER.error("WARNING : GetFoosByName() Procedure is may be missing ", e);
return false;
}
}
@ -61,8 +64,7 @@ public class FooStoredProceduresIntegrationTest {
sqlQuery.list();
return true;
} catch (SQLGrammarException e) {
System.out
.println("WARNING : GetAllFoos() Procedure is may be missing ");
LOGGER.error("WARNING : GetAllFoos() Procedure is may be missing ", e);
return false;
}
}
@ -83,8 +85,7 @@ public class FooStoredProceduresIntegrationTest {
@SuppressWarnings("unchecked")
List<Foo> allFoos = sqlQuery.list();
for (Foo foo : allFoos) {
System.out.println("getAllFoos() SQL Query result : "
+ foo.getName());
LOGGER.info("getAllFoos() SQL Query result : {}", foo.getName());
}
assertEquals(allFoos.size(), fooService.findAll().size());
@ -93,8 +94,7 @@ public class FooStoredProceduresIntegrationTest {
@SuppressWarnings("unchecked")
List<Foo> allFoos2 = namedQuery.list();
for (Foo foo : allFoos2) {
System.out.println("getAllFoos() NamedQuery result : "
+ foo.getName());
LOGGER.info("getAllFoos() NamedQuery result : {}", foo.getName());
}
assertEquals(allFoos2.size(), fooService.findAll().size());
}
@ -110,8 +110,7 @@ public class FooStoredProceduresIntegrationTest {
@SuppressWarnings("unchecked")
List<Foo> allFoosByName = sqlQuery.list();
for (Foo foo : allFoosByName) {
System.out.println("getFoosByName() using SQL Query : found => "
+ foo.toString());
LOGGER.info("getFoosByName() using SQL Query : found => {}", foo.toString());
}
// Stored procedure getFoosByName using getNamedQuery()
@ -120,8 +119,7 @@ public class FooStoredProceduresIntegrationTest {
@SuppressWarnings("unchecked")
List<Foo> allFoosByName2 = namedQuery.list();
for (Foo foo : allFoosByName2) {
System.out.println("getFoosByName() using Native Query : found => "
+ foo.toString());
LOGGER.info("getFoosByName() using Native Query : found => {}", foo.toString());
}
}