This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MagicMatcher <T> implements InvocationHandler { | |
| //... | |
| public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { | |
| if () { | |
| //... | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MagicMatcher <T> implements InvocationHandler { | |
| //... | |
| public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { | |
| if ("matches".equals(method.getName())) { | |
| for (Entry<String, Object> entry : methodMap.entrySet()) { | |
| String field = entry.getKey().substring(entry.getKey().indexOf("with") + 4); | |
| Object objectValue = extractObjectValue((T) args[0], entry.getKey()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface PersonMatcher extends Matcher<Person> { | |
| PersonMatcher withName(String expected); | |
| PersonMatcher withName(Matcher<? super String> matching); | |
| PersonMatcher withAge(int expected); | |
| PersonMatcher withAge(Matcher<Integer> matching); | |
| PersonMatcher withOptions(List<String> options); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PersonTest { | |
| private Person person; | |
| @Before | |
| public void setUp() { | |
| person = new Person(); | |
| } | |
| @Test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package br.org.roger.model; | |
| import java.util.List; | |
| public class Person { | |
| private String name; | |
| private int age; | |
| private List<String> options; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) { | |
| SimpleWebServiceService wsClient = new SimpleWebServiceService(); | |
| wsClient.setHandlerResolver(new MyHandlerResolver()); | |
| final SimpleWebService simpleWebServicePort = wsClient.getSimpleWebServicePort(); | |
| System.out.println(simpleWebServicePort.sayHello("Guest")); | |
| } | |
| public static class MyHandlerResolver implements HandlerResolver { | |
| public List<Handler> getHandlerChain(PortInfo portInfo) { | |
| List<Handler> handlers = new ArrayList<Handler>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <configuration> | |
| <property name="SERVER_LOG_PATH" value="${server.logging.path:-/var/log/fitnesstracker}"/> | |
| ... | |
| <appender name="SQLONLY_SERVER_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| <file>${SERVER_LOG_PATH}/sqlonly.log</file> | |
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
| <fileNamePattern>${SERVER_LOG_PATH}/sqlonly-%d{yyyy-MM-dd}.log</fileNamePattern> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| <bean id="dataSourceSpied" | |
| class="org.springframework.jdbc.datasource.DriverManagerDataSource"> | |
| <property name="driverClassName" value="com.mysql.jdbc.Driver" /> | |
| <property name="url" value="jdbc:mysql://localhost:3306/fitnessTracker?autoReconnect=true" /> | |
| <property name="username" value="root" /> | |
| <property name="password" value="password" /> | |
| </bean> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| <dependency> | |
| <groupId>org.bgee.log4jdbc-log4j2</groupId> | |
| <artifactId>log4jdbc-log4j2-jdbc4</artifactId> | |
| <version>1.16</version> | |
| </dependency> | |
| <dependency> | |
| <groupId>ch.qos.logback</groupId> | |
| <artifactId>logback-classic</artifactId> | |
| <version>1.1.3</version> |