Skip to content

Commit

Permalink
fix: use correct null check in setTooltipGenerator (#4236) (#4239)
Browse files Browse the repository at this point in the history
Co-authored-by: Serhii Kulykov <[email protected]>
  • Loading branch information
vaadin-bot and web-padawan authored Nov 28, 2022
1 parent e4f09be commit c39b1a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ public Column<T> setClassNameGenerator(
*/
public Column<T> setTooltipGenerator(
SerializableFunction<T, String> tooltipGenerator) {
Objects.requireNonNull(classNameGenerator,
Objects.requireNonNull(tooltipGenerator,
"Tooltip generator can not be null");

if (!getGrid().getElement().getChildren().anyMatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public void setAnotherTooltipGenerator_hasOneTooltipElement() {
Assert.assertEquals(1, getTooltipElements(grid).count());
}

@Test(expected = NullPointerException.class)
public void setNullTooltipGenerator_throws() {
grid.addColumn(item -> item).setTooltipGenerator(null);
}

private Optional<Element> getTooltipElement(Grid<?> grid) {
return getTooltipElements(grid).findFirst();
}
Expand Down

0 comments on commit c39b1a9

Please sign in to comment.