File tree Expand file tree Collapse file tree
main/java/com/baeldung/pattern/templatemethod
test/java/com/baeldung/pattern/templatemethod/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" ?>
22<project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
33 <modelVersion >4.0.0</modelVersion >
4- <groupId >com.baeldung.templatemethod</groupId >
5- <artifactId >template-method </artifactId >
4+ <groupId >com.baeldung.pattern. templatemethod</groupId >
5+ <artifactId >pattern.templatemethod </artifactId >
66 <version >1.0</version >
77 <packaging >jar</packaging >
88 <parent >
Original file line number Diff line number Diff line change 1- package com .baeldung .templatemethodpattern .application ;
1+ package com .baeldung .pattern . templatemethod .application ;
22
3- import com .baeldung .templatemethodpattern .model .Computer ;
4- import com .baeldung .templatemethodpattern .model .StandardComputer ;
5- import com .baeldung .templatemethodpattern .model .HighEndComputer ;
6- import com .baeldung .templatemethodpattern .model .ComputerBuilder ;
7- import com .baeldung .templatemethodpattern .model .HighEndComputerBuilder ;
8- import com .baeldung .templatemethodpattern .model .StandardComputerBuilder ;
3+ import com .baeldung .pattern . templatemethod .model .Computer ;
4+ import com .baeldung .pattern . templatemethod .model .StandardComputer ;
5+ import com .baeldung .pattern . templatemethod .model .HighEndComputer ;
6+ import com .baeldung .pattern . templatemethod .model .ComputerBuilder ;
7+ import com .baeldung .pattern . templatemethod .model .HighEndComputerBuilder ;
8+ import com .baeldung .pattern . templatemethod .model .StandardComputerBuilder ;
99
1010public class Application {
1111
Original file line number Diff line number Diff line change 1- package com .baeldung .templatemethodpattern .model ;
1+ package com .baeldung .pattern . templatemethod .model ;
22
33import java .util .HashMap ;
44import java .util .Map ;
5- import java .util .ArrayList ;
6- import java .util .List ;
75
86public class Computer {
97
Original file line number Diff line number Diff line change 1- package com .baeldung .templatemethodpattern .model ;
1+ package com .baeldung .pattern . templatemethod .model ;
22
3+ import com .baeldung .pattern .templatemethod .model .Computer ;
34import java .util .ArrayList ;
45import java .util .HashMap ;
56import java .util .List ;
Original file line number Diff line number Diff line change 1- package com .baeldung .templatemethodpattern .model ;
1+ package com .baeldung .pattern . templatemethod .model ;
22
3+ import com .baeldung .pattern .templatemethod .model .Computer ;
34import java .util .Map ;
45
56public class HighEndComputer extends Computer {
67
78 public HighEndComputer (Map <String , String > computerParts ) {
89 super (computerParts );
9- }
10+ }
1011}
Original file line number Diff line number Diff line change 1- package com .baeldung .templatemethodpattern .model ;
1+ package com .baeldung .pattern . templatemethod .model ;
22
33public class HighEndComputerBuilder extends ComputerBuilder {
44
Original file line number Diff line number Diff line change 1- package com .baeldung .templatemethodpattern .model ;
1+ package com .baeldung .pattern . templatemethod .model ;
22
3+ import com .baeldung .pattern .templatemethod .model .Computer ;
34import java .util .Map ;
45
56public class StandardComputer extends Computer {
67
78 public StandardComputer (Map <String , String > computerParts ) {
89 super (computerParts );
9- }
10+ }
1011}
Original file line number Diff line number Diff line change 1- package com .baeldung .templatemethodpattern .model ;
1+ package com .baeldung .pattern . templatemethod .model ;
22
33public class StandardComputerBuilder extends ComputerBuilder {
44
Original file line number Diff line number Diff line change 1- package com .baeldung .templatemethodpatterntest ;
1+ package com .baeldung .pattern . templatemethod . test ;
22
3- import com .baeldung .templatemethodpattern .model .Computer ;
4- import com .baeldung .templatemethodpattern .model .HighEndComputerBuilder ;
5- import com .baeldung .templatemethodpattern .model .StandardComputerBuilder ;
6- import com .baeldung .templatemethodpattern .model .HighEndComputer ;
7- import com .baeldung .templatemethodpattern .model .StandardComputer ;
3+ import com .baeldung .pattern .templatemethod .model .Computer ;
4+ import com .baeldung .pattern .templatemethod .model .HighEndComputerBuilder ;
5+ import com .baeldung .pattern .templatemethod .model .StandardComputerBuilder ;
86import org .junit .Assert ;
97import static org .junit .Assert .assertEquals ;
108import org .junit .BeforeClass ;
@@ -82,7 +80,7 @@ public void givenAllHighEnddParts_whenBuildingComputer_thenTwoParts() {
8280 assertEquals (2 , highEndComputerBuilder .getComputerParts ().size ());
8381 }
8482
85- @ Test
83+ @ Test
8684 public void givenAllHighEndParts_whenComputerisBuilt_thenComputerInstance () {
8785 assertThat (standardComputerBuilder .buildComputer (), instanceOf (Computer .class ));
8886 }
Original file line number Diff line number Diff line change 99 <modules >
1010 <module >front-controller</module >
1111 <module >intercepting-filter</module >
12- <module >template-method </module >
12+ <module >behavioral-patterns </module >
1313 </modules >
1414
1515 <parent >
You can’t perform that action at this time.
0 commit comments