Java 11 migration: patterns (t-v) (#1085)

* Moves visitor pattern to java 11

* Moves value-object pattern to java 11

* Moves unit-of-work pattern to java 11

* Moves typeobjectpattern pattern to java 11

* Moves twin pattern to java 11

* Moves trampoline pattern to java 11

* Moves tolerant-reader pattern to java 11

* Moves tls pattern to java 11

* Moves throttling pattern to java 11

* Moves thread-pool pattern to java 11

* Moves template-method pattern to java 11
This commit is contained in:
Anurag Agarwal
2019-11-14 11:12:05 +05:30
committed by Ilkka Seppälä
parent 160b737dcc
commit 50467c9e76
45 changed files with 379 additions and 422 deletions

View File

@ -26,15 +26,12 @@ package com.iluwatar.templatemethod;
import org.junit.jupiter.api.Test;
/**
*
* Application test
*
*/
public class AppTest {
@Test
public void test() {
String[] args = {};
App.main(args);
App.main(new String[]{});
}
}

View File

@ -23,12 +23,12 @@
package com.iluwatar.templatemethod;
import org.junit.jupiter.api.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import org.junit.jupiter.api.Test;
/**
* Date: 12/29/15 - 18:15 PM
*
@ -41,8 +41,8 @@ public class HalflingThiefTest {
*/
@Test
public void testSteal() {
final StealingMethod method = mock(StealingMethod.class);
final HalflingThief thief = new HalflingThief(method);
final var method = mock(StealingMethod.class);
final var thief = new HalflingThief(method);
thief.steal();
verify(method).steal();
@ -55,13 +55,13 @@ public class HalflingThiefTest {
*/
@Test
public void testChangeMethod() {
final StealingMethod initialMethod = mock(StealingMethod.class);
final HalflingThief thief = new HalflingThief(initialMethod);
final var initialMethod = mock(StealingMethod.class);
final var thief = new HalflingThief(initialMethod);
thief.steal();
verify(initialMethod).steal();
final StealingMethod newMethod = mock(StealingMethod.class);
final var newMethod = mock(StealingMethod.class);
thief.changeMethod(newMethod);
thief.steal();

View File

@ -23,6 +23,9 @@
package com.iluwatar.templatemethod;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase;
@ -33,11 +36,9 @@ 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
* @author Jeroen Meulemeester
*/