Skip to content

Commit e20b0fe

Browse files
committed
refactor: rename api to minimize the need for refactoring
1 parent 60dd913 commit e20b0fe

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
@@ -21,7 +21,7 @@ public class PopupButtonFixture implements SpreadsheetFixture {
2121
@Override
2222
public void loadFixture(final Spreadsheet spreadsheet) {
2323
spreadsheet.addSelectionChangeListener(event -> {
24-
if (event.getAllSelectedCells().getCellCount() != 1) {
24+
if (event.getAllSelectedCells().size() != 1) {
2525
return;
2626
}
2727
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
@@ -54,25 +54,23 @@ public void formulaChangeResultingInSameValue() {
5454
spreadsheet.getCellValueManager().onCellValueChange(3, 1, "=A1+2*B1");
5555

5656
assertEquals("There should be one changed cell", 1,
57-
changedCells.get().getCellCount());
57+
changedCells.get().size());
5858
assertTrue("The changed cells should include C1 with sheet name",
59-
changedCells.get()
60-
.containsCell(new CellReference("Sheet0!C1")));
59+
changedCells.get().contains(new CellReference("Sheet0!C1")));
6160
assertFalse(
6261
"The changed cells should not include C1 with a wrong sheet name",
63-
changedCells.get()
64-
.containsCell(new CellReference("Sheet1!C1")));
62+
changedCells.get().contains(new CellReference("Sheet1!C1")));
6563
assertTrue("The changed cells should include C1 without sheet name",
66-
changedCells.get().containsCell(new CellReference("C1")));
64+
changedCells.get().contains(new CellReference("C1")));
6765
assertTrue(
6866
"The changed cells should include a cell with correct indexes without a sheet name",
69-
changedCells.get().containsCell(0, 2));
67+
changedCells.get().contains(0, 2));
7068
assertTrue(
7169
"The changed cells should include a cell with correct indexes and sheet name",
72-
changedCells.get().containsCell(0, 2, "Sheet0"));
70+
changedCells.get().contains(0, 2, "Sheet0"));
7371
assertFalse(
7472
"The changed cells should not include a cell with correct indexes and a wrong sheet name",
75-
changedCells.get().containsCell(0, 2, "Sheet1"));
73+
changedCells.get().contains(0, 2, "Sheet1"));
7674

7775
}
7876

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
@@ -64,7 +64,7 @@ public void formulaValueChangeListener_invokedOnFormulaValueChange() {
6464
spreadsheet.refreshCells(A1, A2);
6565

6666
// Check that the event was fired with the correct values
67-
Assert.assertEquals(event.get().getChangedCells().getCellCount(), 1);
67+
Assert.assertEquals(event.get().getChangedCells().size(), 1);
6868
Assert.assertEquals(event.get().getChangedCells().getCells().iterator()
6969
.next().formatAsString(), "Sheet1!A1");
7070
// Sanity check for the forumula cell effective value

0 commit comments

Comments
 (0)