### Question:
Cells { public static boolean isEmpty(Cell cell) { PositionHandler handler = cell.get(PositionHandler.PROPERTY); return handler.isEmpty(); }  static Cell getNonPopupAncestor(Cell c); static boolean inPopup(Cell cell); static boolean isEmpty(Cell cell); static boolean isLeaf(Cell cell); static Cell findCell(Cell current, Vector loc); static Cell findClosestFocusableToSide(Cell current, Vector loc); static Cell firstVisibleLeaf(Cell cell); static Cell lastVisibleLeaf(Cell cell); static Rectangle indentBounds(IndentCell cell); static final CellTraitEventSpec<Event> BECAME_EMPTY; static final CellTraitEventSpec<Event> BECAME_INVALID; static final CellTraitEventSpec<Event> AFTER_EDITED; static final CellTraitEventSpec<Event> AFTER_COMPLETED; }### Answer:
@Test public void emptinessOfEmptyText() { TextCell cell = new TextCell(); cell.text().set(""); assertTrue(Cells.isEmpty(cell)); }
@Test public void emptinessOfNullText() { TextCell cell = new TextCell(); cell.text().set(null); assertTrue(Cells.isEmpty(cell)); }
@Test public void nonEmptinessOfNonEmptyText() { TextCell cell = new TextCell(); cell.text().set("aaa"); assertFalse(Cells.isEmpty(cell)); }
@Test public void nonEmptinessOfComposite() { assertTrue(Cells.isEmpty(new HorizontalCell())); }
@Test public void emptinessOfCellWithPositionHandler() { VerticalCell cell = new VerticalCell(); cell.children().add(new TextCell()); cell.addTrait(new CellTrait() { @Override public Object get(Cell cell, CellTraitPropertySpec<?> spec) { if (spec == PositionHandler.PROPERTY) { return new PositionHandler() { @Override public boolean isHome() { return true; } @Override public boolean isEnd() { return true; } @Override public boolean isEmpty() { return true; } @Override public void home() { } @Override public void end() { } @Override public Property<Integer> caretOffset() { return new ValueProperty<>(0); } }; } return super.get(cell, spec); } }); assertTrue(Cells.isEmpty(cell)); }
@Test public void emptinessOfVerticalCell() { VerticalCell cell = new VerticalCell(); cell.children().add(new TextCell()); assertTrue(Cells.isEmpty(cell)); }