### Question:
CellGrid { public C getCellSafe(int x, int y) { C cell = getCell(x, y); if (cell == null) { cell = createCell(x, y); setCell(x, y, cell); } return cell; } @SuppressWarnings("unchecked") private  CellGrid(GridDef gridDef, CellFactory<? extends C> cellFactory); static CellGrid<C> create(GridDef gridDef, CellFactory<? extends C> cellFactory); int getWidth(); int getHeight(); GridDef getGridDef(); CellFactory<? extends C> getCellFactory(); C getCellSafe(int x, int y); C getCell(int x, int y); void setCell(C cell); void setCell(int x, int y, C cell); C createCell(int x, int y); @SuppressWarnings("unchecked") List<C> getCells(); List<C> getCells(CellFilter<C> filter);  }### Answer:
@Test public void testGetCellSafe() throws Exception { CellGrid<MyCell> grid = createGrid(GridDef.createGlobal(5.0)); assertNull(grid.getCell(0, 9)); MyCell cell = grid.getCellSafe(0, 9); assertNotNull(cell); assertSame(cell, grid.getCell(0, 9)); assertSame(cell, grid.getCellSafe(0, 9)); }