BAEL-4844: Fixing the indentation.
This commit is contained in:
parent
cfee931194
commit
78faf1e871
@ -7,13 +7,13 @@ import org.springframework.stereotype.Component;
|
|||||||
@Trace
|
@Trace
|
||||||
@Component
|
@Component
|
||||||
public class MyTracedService {
|
public class MyTracedService {
|
||||||
private static final Log LOG = LogFactory.getLog(MyTracedService.class);
|
private static final Log LOG = LogFactory.getLog(MyTracedService.class);
|
||||||
|
|
||||||
public void performSomeLogic() {
|
public void performSomeLogic() {
|
||||||
LOG.info("Inside performSomeLogic...");
|
LOG.info("Inside performSomeLogic...");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performSomeAdditionalLogic() {
|
public void performSomeAdditionalLogic() {
|
||||||
LOG.info("Inside performSomeAdditionalLogic...");
|
LOG.info("Inside performSomeAdditionalLogic...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ import org.springframework.stereotype.Component;
|
|||||||
@Component
|
@Component
|
||||||
public class MyTracedServiceConsumer {
|
public class MyTracedServiceConsumer {
|
||||||
|
|
||||||
public MyTracedServiceConsumer(MyTracedService myTracedService) {
|
public MyTracedServiceConsumer(MyTracedService myTracedService) {
|
||||||
myTracedService.performSomeLogic();
|
myTracedService.performSomeLogic();
|
||||||
myTracedService.performSomeAdditionalLogic();
|
myTracedService.performSomeAdditionalLogic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,20 +11,22 @@ import static org.mockito.Mockito.verify;
|
|||||||
|
|
||||||
public class MyTracedServiceConsumerUnitTest {
|
public class MyTracedServiceConsumerUnitTest {
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public MockitoRule mockitoRule = MockitoJUnit.rule();
|
public MockitoRule mockitoRule = MockitoJUnit.rule();
|
||||||
|
|
||||||
@Spy
|
@Spy
|
||||||
private MyTracedService myTracedService;
|
private MyTracedService myTracedService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenCallingConsumer_thenServiceIsCalled() {
|
public void whenCallingConsumer_thenServiceIsCalled() {
|
||||||
doNothing().when(myTracedService).performSomeLogic();
|
doNothing().when(myTracedService)
|
||||||
doNothing().when(myTracedService).performSomeAdditionalLogic();
|
.performSomeLogic();
|
||||||
|
doNothing().when(myTracedService)
|
||||||
|
.performSomeAdditionalLogic();
|
||||||
|
|
||||||
new MyTracedServiceConsumer(myTracedService);
|
new MyTracedServiceConsumer(myTracedService);
|
||||||
|
|
||||||
verify(myTracedService).performSomeLogic();
|
verify(myTracedService).performSomeLogic();
|
||||||
verify(myTracedService).performSomeAdditionalLogic();
|
verify(myTracedService).performSomeAdditionalLogic();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,28 +13,28 @@ import static org.junit.Assert.assertTrue;
|
|||||||
*/
|
*/
|
||||||
public class MyTracedServiceUnitTest {
|
public class MyTracedServiceUnitTest {
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public OutputCaptureRule outputCaptureRule = new OutputCaptureRule();
|
public OutputCaptureRule outputCaptureRule = new OutputCaptureRule();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenPerformingSomeLogic_thenTraceAndInfoOutputIsWritten() {
|
public void whenPerformingSomeLogic_thenTraceAndInfoOutputIsWritten() {
|
||||||
MyTracedService myTracedService = new MyTracedService();
|
MyTracedService myTracedService = new MyTracedService();
|
||||||
myTracedService.performSomeLogic();
|
myTracedService.performSomeLogic();
|
||||||
|
|
||||||
String output = outputCaptureRule.getOut();
|
String output = outputCaptureRule.getOut();
|
||||||
assertTrue(output.contains("TracingAspect - Entering MyTracedService.performSomeLogic"));
|
assertTrue(output.contains("TracingAspect - Entering MyTracedService.performSomeLogic"));
|
||||||
assertTrue(output.contains("MyTracedService - Inside performSomeLogic"));
|
assertTrue(output.contains("MyTracedService - Inside performSomeLogic"));
|
||||||
assertTrue(output.contains("TracingAspect - Exiting MyTracedService.performSomeLogic"));
|
assertTrue(output.contains("TracingAspect - Exiting MyTracedService.performSomeLogic"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenPerformingSomeAdditionalLogic_thenTraceAndInfoOutputIsWritten() {
|
public void whenPerformingSomeAdditionalLogic_thenTraceAndInfoOutputIsWritten() {
|
||||||
MyTracedService myTracedService = new MyTracedService();
|
MyTracedService myTracedService = new MyTracedService();
|
||||||
myTracedService.performSomeAdditionalLogic();
|
myTracedService.performSomeAdditionalLogic();
|
||||||
|
|
||||||
String output = outputCaptureRule.getOut();
|
String output = outputCaptureRule.getOut();
|
||||||
assertTrue(output.contains("TracingAspect - Entering MyTracedService.performSomeAdditionalLogic"));
|
assertTrue(output.contains("TracingAspect - Entering MyTracedService.performSomeAdditionalLogic"));
|
||||||
assertTrue(output.contains("MyTracedService - Inside performSomeAdditionalLogic"));
|
assertTrue(output.contains("MyTracedService - Inside performSomeAdditionalLogic"));
|
||||||
assertTrue(output.contains("TracingAspect - Exiting MyTracedService.performSomeAdditionalLogic"));
|
assertTrue(output.contains("TracingAspect - Exiting MyTracedService.performSomeAdditionalLogic"));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user