Skip to content

Commit e22c3cd

Browse files
Add DisplayName annotations to react
1 parent 4541c60 commit e22c3cd

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

exercises/practice/react/src/test/java/ReactTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.junit.jupiter.api.Disabled;
2+
import org.junit.jupiter.api.DisplayName;
23
import org.junit.jupiter.api.Test;
34

45
import java.util.ArrayList;
@@ -10,6 +11,7 @@
1011
public class ReactTest {
1112

1213
@Test
14+
@DisplayName("input cells have a value")
1315
public void testInputCellHasValue() {
1416
var input = React.inputCell(10);
1517

@@ -18,6 +20,7 @@ public void testInputCellHasValue() {
1820

1921
@Disabled("Remove to run")
2022
@Test
23+
@DisplayName("an input cell's value can be set")
2124
public void testInputCellValueCanBeSet() {
2225
var input = React.inputCell(4);
2326
input.setValue(20);
@@ -27,6 +30,7 @@ public void testInputCellValueCanBeSet() {
2730

2831
@Disabled("Remove to run")
2932
@Test
33+
@DisplayName("compute cells calculate initial value")
3034
public void testComputeCellCalculateInitialValue() {
3135
var input = React.inputCell(1);
3236
var output = React.computeCell(list -> list.get(0) + 1, List.of(input));
@@ -36,6 +40,7 @@ public void testComputeCellCalculateInitialValue() {
3640

3741
@Disabled("Remove to run")
3842
@Test
43+
@DisplayName("compute cells take inputs in the right order")
3944
public void testComputeCellsInTheRightOrder() {
4045
var first = React.inputCell(1);
4146
var second = React.inputCell(2);
@@ -46,6 +51,7 @@ public void testComputeCellsInTheRightOrder() {
4651

4752
@Disabled("Remove to run")
4853
@Test
54+
@DisplayName("compute cells update value when dependencies are changed")
4955
public void testComputeCellsUpdateValueWhenDependenciesAreChanged() {
5056
var input = React.inputCell(1);
5157
var output = React.computeCell(list -> list.get(0) + 1, List.of(input));
@@ -56,6 +62,7 @@ public void testComputeCellsUpdateValueWhenDependenciesAreChanged() {
5662

5763
@Disabled("Remove to run")
5864
@Test
65+
@DisplayName("compute cells can depend on other compute cells")
5966
public void testComputeCellsCanDependOnOtherComputeCells() {
6067
var input = React.inputCell(1);
6168
var timesTwo = React.computeCell(list -> list.get(0) * 2, List.of(input));
@@ -70,6 +77,7 @@ public void testComputeCellsCanDependOnOtherComputeCells() {
7077

7178
@Disabled("Remove to run")
7279
@Test
80+
@DisplayName("compute cells fire callbacks")
7381
public void testComputeCellsFireCallbacks() {
7482
var input = React.inputCell(1);
7583
var output = React.computeCell(list -> list.get(0) + 1, List.of(input));
@@ -83,6 +91,7 @@ public void testComputeCellsFireCallbacks() {
8391

8492
@Disabled("Remove to run")
8593
@Test
94+
@DisplayName("callback cells only fire on change")
8695
public void testCallbacksOnlyFireOnChange() {
8796
var input = React.inputCell(1);
8897
var output = React.computeCell(list -> list.get(0) < 3 ? 111 : 222, List.of(input));
@@ -99,6 +108,7 @@ public void testCallbacksOnlyFireOnChange() {
99108

100109
@Disabled("Remove to run")
101110
@Test
111+
@DisplayName("callbacks do not report already reported values")
102112
public void testCallbacksDoNotReportAlreadyReportedValues() {
103113
var input = React.inputCell(1);
104114
var output = React.computeCell(list -> list.get(0) + 1, List.of(input));
@@ -116,6 +126,7 @@ public void testCallbacksDoNotReportAlreadyReportedValues() {
116126

117127
@Disabled("Remove to run")
118128
@Test
129+
@DisplayName("callbacks can fire from multiple cells")
119130
public void testCallbacksCanFireFromMultipleCells() {
120131
var input = React.inputCell(1);
121132
var plusOne = React.computeCell(list -> list.get(0) + 1, List.of(input));
@@ -134,6 +145,7 @@ public void testCallbacksCanFireFromMultipleCells() {
134145

135146
@Disabled("Remove to run")
136147
@Test
148+
@DisplayName("callbacks can be added and removed")
137149
public void testCallbacksCanBeAddedAndRemoved() {
138150
var input = React.inputCell(11);
139151
var output = React.computeCell(list -> list.get(0) + 1, List.of(input));
@@ -166,6 +178,7 @@ public void testCallbacksCanBeAddedAndRemoved() {
166178

167179
@Disabled("Remove to run")
168180
@Test
181+
@DisplayName("removing a callback multiple times doesn't interfere with other callbacks")
169182
public void testRemovingACallbackMultipleTimesDoesntInterfereWithOtherCallbacks() {
170183
var input = React.inputCell(1);
171184
var output = React.computeCell(list -> list.get(0) + 1, List.of(input));
@@ -189,6 +202,7 @@ public void testRemovingACallbackMultipleTimesDoesntInterfereWithOtherCallbacks(
189202

190203
@Disabled("Remove to run")
191204
@Test
205+
@DisplayName("callbacks should only be called once even if multiple dependencies change")
192206
public void testCallbacksShouldOnlyBeCalledOnceEvenIfMultipleDependenciesChange() {
193207
var input = React.inputCell(1);
194208
var plusOne = React.computeCell(list -> list.get(0) + 1, List.of(input));
@@ -205,6 +219,7 @@ public void testCallbacksShouldOnlyBeCalledOnceEvenIfMultipleDependenciesChange(
205219

206220
@Disabled("Remove to run")
207221
@Test
222+
@DisplayName("callbacks should not be called if dependencies change but output value doesn't change")
208223
public void testCallbacksShouldNotBeCalledIfDependenciesChangeButOutputValueDoesntChange() {
209224
var input = React.inputCell(1);
210225
var plusOne = React.computeCell(list -> list.get(0) + 1, List.of(input));

0 commit comments

Comments
 (0)