BAEL-2431 Implementing multi-inheritance and Polymorphism using interfaces (#5924)
* Implementing Hexagonal Architecture in java * Implementing multi-inheritance and Polymorphism using interfaces * Removing hexagonal code * Deleting hexagonal architecture code * fix for unit test names
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.baeldung.interfaces;
|
||||
|
||||
import com.baeldung.interfaces.polymorphysim.Circle;
|
||||
import com.baeldung.interfaces.polymorphysim.Shape;
|
||||
import com.baeldung.interfaces.polymorphysim.Square;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PolymorphysimUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenInterfacePointsToCircle_CircleAreaMethodisBeingCalled(){
|
||||
double expectedArea = 12.566370614359172;
|
||||
Shape circle = new Circle(2);
|
||||
double actualArea = circle.area();
|
||||
Assertions.assertThat(actualArea).isEqualTo(expectedArea);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenInterfacePointsToSquare_SquareAreaMethodisBeingCalled(){
|
||||
double expectedArea = 4;
|
||||
Shape square = new Square(2);
|
||||
double actualArea = square.area();
|
||||
Assertions.assertThat(actualArea).isEqualTo(expectedArea);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user