Java 11 migration: patterns starting with a (#1084)
* Moves abstract-factory pattern to java 11 * Moves abstract-document pattern to java 11 * Moves acyclic-visitor pattern to java 11 * Moves adapter pattern to java 11 * Moves aggregator-microservices pattern to java 11 * Moves api-gateway pattern to java 11
This commit is contained in:
committed by
Ilkka Seppälä
parent
3c57bf7078
commit
f04fc3c0dc
@ -23,18 +23,16 @@
|
||||
|
||||
package com.iluwatar.adapter;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test class
|
||||
*
|
||||
*/
|
||||
public class AdapterPatternTest {
|
||||
|
||||
@ -51,7 +49,7 @@ public class AdapterPatternTest {
|
||||
public void setup() {
|
||||
beans = new HashMap<>();
|
||||
|
||||
FishingBoatAdapter fishingBoatAdapter = spy(new FishingBoatAdapter());
|
||||
var fishingBoatAdapter = spy(new FishingBoatAdapter());
|
||||
beans.put(FISHING_BEAN, fishingBoatAdapter);
|
||||
|
||||
var captain = new Captain();
|
||||
@ -60,10 +58,10 @@ public class AdapterPatternTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* This test asserts that when we use the row() method on a captain bean(client), it is
|
||||
* internally calling sail method on the fishing boat object. The Adapter ({@link FishingBoatAdapter}
|
||||
* ) converts the interface of the target class ( {@link FishingBoat}) into a suitable one
|
||||
* expected by the client ({@link Captain} ).
|
||||
* This test asserts that when we use the row() method on a captain bean(client), it is internally
|
||||
* calling sail method on the fishing boat object. The Adapter ({@link FishingBoatAdapter} )
|
||||
* converts the interface of the target class ( {@link FishingBoat}) into a suitable one expected
|
||||
* by the client ({@link Captain} ).
|
||||
*/
|
||||
@Test
|
||||
public void testAdapter() {
|
||||
|
@ -25,15 +25,12 @@ package com.iluwatar.adapter;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Tests that Adapter example runs without errors.
|
||||
*/
|
||||
public class AppTest {
|
||||
@Test
|
||||
public void test() throws IOException {
|
||||
String[] args = {};
|
||||
App.main(args);
|
||||
public void test() {
|
||||
App.main(new String[]{});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user