From e1f7667f0aecfc4e055be7ce44782ab1a5c0cce0 Mon Sep 17 00:00:00 2001 From: Hammy Date: Mon, 14 Dec 2020 23:06:01 +0000 Subject: [PATCH] Test Adapter Pattern --- .../adapter/animal/tests/BirdAdapterTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Design Patterns/src/adapter/animal/tests/BirdAdapterTest.java diff --git a/Design Patterns/src/adapter/animal/tests/BirdAdapterTest.java b/Design Patterns/src/adapter/animal/tests/BirdAdapterTest.java new file mode 100644 index 0000000..69849d8 --- /dev/null +++ b/Design Patterns/src/adapter/animal/tests/BirdAdapterTest.java @@ -0,0 +1,21 @@ +package adapter.animal.tests; + +import adapter.animal.Bird; +import adapter.animal.BirdAdapter; +import adapter.animal.Sparrow; +import adapter.animal.ToyDuck; +import org.junit.jupiter.api.Test; + +import static org.mockito.Mockito.*; + +class BirdAdapterTest { + + @Test + void verifyMakeSoundIsCalled() { + Bird mockedSparrow = mock(Sparrow.class); + ToyDuck birdAdapter = new BirdAdapter(mockedSparrow); + + birdAdapter.squeak(); + verify(mockedSparrow, times(1)).makeSound(); + } +} \ No newline at end of file