File tree Expand file tree Collapse file tree 4 files changed +55
-0
lines changed
스프링 로드맵5 고급편/proxy/src/test/java/hello/proxy/pureproxy/decorator Expand file tree Collapse file tree 4 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ package hello .proxy .pureproxy .decorator ;
2
+
3
+ import hello .proxy .pureproxy .decorator .code .DecoratorPatternClient ;
4
+ import hello .proxy .pureproxy .decorator .code .RealComponent ;
5
+ import lombok .extern .slf4j .Slf4j ;
6
+ import org .junit .jupiter .api .Test ;
7
+
8
+ @ Slf4j
9
+ public class DecoratorPatternTest {
10
+
11
+ @ Test
12
+ void noDecoration () {
13
+ RealComponent realComponent = new RealComponent ();
14
+ DecoratorPatternClient client = new DecoratorPatternClient (realComponent );
15
+
16
+ client .execute ();
17
+ client .execute ();
18
+ client .execute ();
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ package hello .proxy .pureproxy .decorator .code ;
2
+
3
+ public interface Component {
4
+ String operation ();
5
+ }
Original file line number Diff line number Diff line change
1
+ package hello .proxy .pureproxy .decorator .code ;
2
+
3
+ import lombok .extern .slf4j .Slf4j ;
4
+
5
+ @ Slf4j
6
+ public class DecoratorPatternClient {
7
+
8
+ private Component component ;
9
+
10
+ public DecoratorPatternClient (final Component component ) {
11
+ this .component = component ;
12
+ }
13
+
14
+ public void execute () {
15
+ String operation = component .operation ();
16
+ log .info ("result = {}" , operation );
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ package hello .proxy .pureproxy .decorator .code ;
2
+
3
+ import lombok .extern .slf4j .Slf4j ;
4
+
5
+ @ Slf4j
6
+ public class RealComponent implements Component {
7
+ @ Override
8
+ public String operation () {
9
+ log .info ("RealComponent 실행" );
10
+ return "data" ;
11
+ }
12
+ }
You can’t perform that action at this time.
0 commit comments