2018-05-11 10:11:13 +03:00
|
|
|
package com.baeldung;
|
2017-08-08 23:26:53 +05:30
|
|
|
|
2017-09-18 05:29:23 +05:30
|
|
|
import static org.junit.Assert.*;
|
2017-08-08 23:26:53 +05:30
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
2018-05-11 10:11:13 +03:00
|
|
|
import com.baeldung.bridge.Blue;
|
|
|
|
|
import com.baeldung.bridge.Red;
|
|
|
|
|
import com.baeldung.bridge.Shape;
|
|
|
|
|
import com.baeldung.bridge.Square;
|
|
|
|
|
import com.baeldung.bridge.Triangle;
|
2017-08-08 23:26:53 +05:30
|
|
|
|
|
|
|
|
public class BridgePatternIntegrationTest {
|
2017-09-18 05:29:23 +05:30
|
|
|
|
2017-08-08 23:26:53 +05:30
|
|
|
@Test
|
|
|
|
|
public void whenBridgePatternInvoked_thenConfigSuccess() {
|
|
|
|
|
//a square with red color
|
|
|
|
|
Shape square = new Square(new Red());
|
2017-09-18 05:29:23 +05:30
|
|
|
assertEquals(square.draw(), "Square drawn. Color is Red");
|
2017-08-08 23:26:53 +05:30
|
|
|
|
|
|
|
|
//a triangle with blue color
|
|
|
|
|
Shape triangle = new Triangle(new Blue());
|
2017-09-18 05:29:23 +05:30
|
|
|
assertEquals(triangle.draw(), "Triangle drawn. Color is Blue");
|
2017-08-08 23:26:53 +05:30
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|