@Test public void oneDotIsNoShip() throws Exception { char[][] board = new char[][]{ {'.'} }; int count = new Solution().countBattleships(board); assertThat(count, is(0)); }
public int countBattleships(char[][] board) { try { return countFrom(Parser.boardToRootCell(board)); } catch (NoGapBetweenShipsException e) { return 0; } }
Solution { public int countBattleships(char[][] board) { try { return countFrom(Parser.boardToRootCell(board)); } catch (NoGapBetweenShipsException e) { return 0; } } }
Solution { public int countBattleships(char[][] board) { try { return countFrom(Parser.boardToRootCell(board)); } catch (NoGapBetweenShipsException e) { return 0; } }  }
Solution { public int countBattleships(char[][] board) { try { return countFrom(Parser.boardToRootCell(board)); } catch (NoGapBetweenShipsException e) { return 0; } }  int countBattleships(char[][] board); }
Solution { public int countBattleships(char[][] board) { try { return countFrom(Parser.boardToRootCell(board)); } catch (NoGapBetweenShipsException e) { return 0; } }  int countBattleships(char[][] board);  }