-
Notifications
You must be signed in to change notification settings - Fork 176
/
TriangleUtilitiesTest.java
106 lines (86 loc) · 2.6 KB
/
TriangleUtilitiesTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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);
}
}