package ovh.gasser.newshapes.shapes; import org.junit.jupiter.api.Test; import java.awt.Color; import java.awt.Rectangle; import static org.junit.jupiter.api.Assertions.*; class STriangleTest { @Test void testCreate() { STriangle triangle = STriangle.create(10, 20, 50, Color.RED, Color.BLACK); assertNotNull(triangle); assertEquals(50, triangle.getBounds().width); assertEquals(50, triangle.getBounds().height); } @Test void testCloneCreatesIndependentCopy() { STriangle original = STriangle.create(0, 0, 30, Color.BLUE, Color.BLACK); Object cloneObj = original.clone(); assertNotSame(original, cloneObj); assertTrue(cloneObj instanceof STriangle); STriangle clone = (STriangle) cloneObj; assertEquals(original.getBounds(), clone.getBounds()); } @Test void testBoundsAreSetCorrectly() { STriangle triangle = STriangle.create(5, 10, 25, Color.GREEN, Color.BLACK); Rectangle bounds = triangle.getBounds(); assertEquals(5, bounds.x); assertEquals(10, bounds.y); assertEquals(25, bounds.width); assertEquals(25, bounds.height); } }