12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
-
-
-
- import org.junit.Assert;
- import org.junit.Test;
-
- public class TriangleUtilitiesTest {
-
- @Test
- public void getRow() {
- String expected = "********************";
- int width = 20;
- String actual = TriangleUtilities.getRow(width);
- Assert.assertEquals(expected, actual);
- }
-
-
- @Test
- public void getTriangleTest1() {
- String expected =
- "*\n" +
- "**\n" +
- "***\n" +
- "****\n" +
- "*****\n" +
- "******\n" +
- "*******\n" +
- "********\n" +
- "*********\n";
- String actual = TriangleUtilities.getTriangle(10);
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void getTriangleTest2() {
- String expected =
- "*\n" +
- "**\n" +
- "***\n" +
- "****\n";
- String actual = TriangleUtilities.getTriangle(5);
- 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);
- }
- }
|