* BAEL-6300: Problem Reproduction * BAEL-6300: Internal Invocation with External Reference * BAEL-6300: compile-time weaving * BAEL-6300: load-time weaving
24 lines
708 B
Java
24 lines
708 B
Java
package com.baeldung.selfinvocation;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
@SpringBootTest(classes = CompileTimeWeavingApplication.class)
|
|
class CompileTimeWeavingIntegrationTest {
|
|
|
|
@Resource
|
|
private MathService mathService;
|
|
|
|
@Test
|
|
void givenCacheableMethod_whenInvokingByInternalCall_thenCacheIsTriggered() {
|
|
AtomicInteger counter = mathService.resetCounter();
|
|
|
|
assertThat(mathService.sumOfSquareOf2()).isEqualTo(8);
|
|
assertThat(counter.get()).isEqualTo(1);
|
|
}
|
|
} |