Merge branch 'master' into master

This commit is contained in:
Sanket Panhale
2018-01-28 14:44:19 -05:00
committed by GitHub
686 changed files with 6683 additions and 7868 deletions

View File

@@ -3,7 +3,6 @@ layout: pattern
title: Template method
folder: template-method
permalink: /patterns/template-method/
pumlid: NSZ13SCW30NGLPe1mFTkuu0Lg6n0vZjPlpttzlIEFef6bN1zDM3jDv7paw-E5cTiyJ87P22NQTGr7WOxVVZcL6NtQwJ5WFZOPBn_88WjPKWoGPkL1EN_ShZb5QPV
categories: Behavioral
tags:
- Java

View File

@@ -1,39 +0,0 @@
@startuml
package com.iluwatar.templatemethod {
class App {
+ App()
+ main(args : String[]) {static}
}
class HalflingThief {
- method : StealingMethod
+ HalflingThief(method : StealingMethod)
+ changeMethod(method : StealingMethod)
+ steal()
}
class HitAndRunMethod {
- LOGGER : Logger {static}
+ HitAndRunMethod()
# confuseTarget(target : String)
# pickTarget() : String
# stealTheItem(target : String)
}
abstract class StealingMethod {
- LOGGER : Logger {static}
+ StealingMethod()
# confuseTarget(String) {abstract}
# pickTarget() : String {abstract}
+ steal()
# stealTheItem(String) {abstract}
}
class SubtleMethod {
- LOGGER : Logger {static}
+ SubtleMethod()
# confuseTarget(target : String)
# pickTarget() : String
# stealTheItem(target : String)
}
}
HalflingThief --> "-method" StealingMethod
HitAndRunMethod --|> StealingMethod
SubtleMethod --|> StealingMethod
@enduml

View File

@@ -29,13 +29,18 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.17.0-SNAPSHOT</version>
<version>1.19.0-SNAPSHOT</version>
</parent>
<artifactId>template-method</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -22,7 +22,7 @@
*/
package com.iluwatar.templatemethod;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
*

View File

@@ -22,7 +22,7 @@
*/
package com.iluwatar.templatemethod;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

View File

@@ -22,19 +22,19 @@
*/
package com.iluwatar.templatemethod;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase;
import java.util.LinkedList;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Date: 12/30/15 - 18:12 PM
* @param <M> Type of StealingMethod
@@ -44,12 +44,12 @@ public abstract class StealingMethodTest<M extends StealingMethod> {
private InMemoryAppender appender;
@Before
@BeforeEach
public void setUp() {
appender = new InMemoryAppender();
}
@After
@AfterEach
public void tearDown() {
appender.stop();
}