123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
-
-
-
- import org.junit.Assert;
- import org.junit.Test;
-
- public class TriangleUtilitiesTest {
-
- @Test
- public void testGetRow_ForSmallWidth(){
- //Given
- String expected = "*";
- int width = 1;
-
- //When
- String actual = TriangleUtilities.getRow(width);
-
- //Then
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testGetRow_ForBigWidth() {
- //Given
- String expected = "********************";
- int width = 20;
-
- //When
- String actual = TriangleUtilities.getRow(width);
-
- //Then
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testGetTriangle_ForOneRow() {
- // Given
- String expected = "*\n";
-
- // When
- String actual = TriangleUtilities.getTriangle(1);
-
- // Then
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testGetTriangle_ForSmallTriangle() {
- // Given
- String expected =
- "*\n" +
- "**\n" +
- "***\n";
-
- // When
- String actual = TriangleUtilities.getTriangle(3);
-
- // Then
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testGetTriangle_ForBigTriangle() {
- String expected =
- "*\n" +
- "**\n" +
- "***\n" +
- "****\n" +
- "*****\n" +
- "******\n" +
- "*******\n" +
- "********\n" +
- "*********\n" +
- "**********\n";
- String actual = TriangleUtilities.getTriangle(10);
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testGetLargeTriangle() {
- String expected =
- "*\n" +
- "**\n" +
- "***\n" +
- "****\n" +
- "*****\n" +
- "******\n" +
- "*******\n" +
- "********\n" +
- "*********\n";
- String actual = TriangleUtilities.getLargeTriangle();
- Assert.assertEquals(expected, actual);
- }
-
-
- @Test
- public void testGetSmallTriangle() {
- String expected =
- "*\n" +
- "**\n" +
- "***\n" +
- "****\n";
- String actual = TriangleUtilities.getSmallTriangle();
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void test()
- {
- }
- }
-
|