Skip to content

Commit ae9f2d2

Browse files
committed
refactor: rename api to minimize the need for refactoring
1 parent b236546 commit ae9f2d2

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

vaadin-spreadsheet-flow-parent/vaadin-spreadsheet-flow-integration-tests/src/main/java/com/vaadin/flow/component/spreadsheet/tests/fixtures/PopupButtonFixture.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class PopupButtonFixture implements SpreadsheetFixture {
3030
@Override
3131
public void loadFixture(final Spreadsheet spreadsheet) {
3232
spreadsheet.addSelectionChangeListener(event -> {
33-
if (event.getAllSelectedCells().getCellCount() != 1) {
33+
if (event.getAllSelectedCells().size() != 1) {
3434
return;
3535
}
3636
List<String> values = new ArrayList<>(VALUES);

vaadin-spreadsheet-flow-parent/vaadin-spreadsheet-flow/src/main/java/com/vaadin/flow/component/spreadsheet/CellSet.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public Set<CellReference> getCells() {
5454
*
5555
* @return number of cells
5656
*/
57-
public int getCellCount() {
57+
public int size() {
5858
return cells.size();
5959
}
6060

@@ -68,7 +68,7 @@ public int getCellCount() {
6868
* @return {@code true} if set contains the specified cell, {@code false}
6969
* otherwise
7070
*/
71-
public boolean containsCell(CellReference cellReference) {
71+
public boolean contains(CellReference cellReference) {
7272
if (cells.isEmpty()) {
7373
return false;
7474
}
@@ -94,8 +94,8 @@ public boolean containsCell(CellReference cellReference) {
9494
* @return {@code true} if set contains the specified cell, {@code false}
9595
* otherwise
9696
*/
97-
public boolean containsCell(int row, int col) {
98-
return containsCell(new CellReference(row, col));
97+
public boolean contains(int row, int col) {
98+
return contains(new CellReference(row, col));
9999
}
100100

101101
/**
@@ -110,9 +110,8 @@ public boolean containsCell(int row, int col) {
110110
* @return {@code true} if set contains the specified cell, {@code false}
111111
* otherwise
112112
*/
113-
public boolean containsCell(int row, int col, String sheetName) {
113+
public boolean contains(int row, int col, String sheetName) {
114114
Objects.requireNonNull(sheetName, "The sheet name cannot be null");
115-
return containsCell(
116-
new CellReference(sheetName, row, col, false, false));
115+
return contains(new CellReference(sheetName, row, col, false, false));
117116
}
118117
}

vaadin-spreadsheet-flow-parent/vaadin-spreadsheet-flow/src/test/java/com/vaadin/flow/component/spreadsheet/tests/CellValueChangeEventOnFormulaChangeTest.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,23 @@ public void formulaChangeResultingInSameValue() {
6262
spreadsheet.getCellValueManager().onCellValueChange(3, 1, "=A1+2*B1");
6363

6464
assertEquals("There should be one changed cell", 1,
65-
changedCells.get().getCellCount());
65+
changedCells.get().size());
6666
assertTrue("The changed cells should include C1 with sheet name",
67-
changedCells.get()
68-
.containsCell(new CellReference("Sheet0!C1")));
67+
changedCells.get().contains(new CellReference("Sheet0!C1")));
6968
assertFalse(
7069
"The changed cells should not include C1 with a wrong sheet name",
71-
changedCells.get()
72-
.containsCell(new CellReference("Sheet1!C1")));
70+
changedCells.get().contains(new CellReference("Sheet1!C1")));
7371
assertTrue("The changed cells should include C1 without sheet name",
74-
changedCells.get().containsCell(new CellReference("C1")));
72+
changedCells.get().contains(new CellReference("C1")));
7573
assertTrue(
7674
"The changed cells should include a cell with correct indexes without a sheet name",
77-
changedCells.get().containsCell(0, 2));
75+
changedCells.get().contains(0, 2));
7876
assertTrue(
7977
"The changed cells should include a cell with correct indexes and sheet name",
80-
changedCells.get().containsCell(0, 2, "Sheet0"));
78+
changedCells.get().contains(0, 2, "Sheet0"));
8179
assertFalse(
8280
"The changed cells should not include a cell with correct indexes and a wrong sheet name",
83-
changedCells.get().containsCell(0, 2, "Sheet1"));
81+
changedCells.get().contains(0, 2, "Sheet1"));
8482

8583
}
8684

vaadin-spreadsheet-flow-parent/vaadin-spreadsheet-flow/src/test/java/com/vaadin/flow/component/spreadsheet/tests/FormulasTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void formulaValueChangeListener_invokedOnFormulaValueChange() {
8383
spreadsheet.refreshCells(A1, A2);
8484

8585
// Check that the event was fired with the correct values
86-
Assert.assertEquals(event.get().getChangedCells().getCellCount(), 1);
86+
Assert.assertEquals(event.get().getChangedCells().size(), 1);
8787
Assert.assertEquals(event.get().getChangedCells().getCells().iterator()
8888
.next().formatAsString(), "Sheet1!A1");
8989
// Sanity check for the forumula cell effective value

0 commit comments

Comments
 (0)