@Test public void testFormatWithEmptyAndOtherUnknownCharacter() { GameMatrix matrix = gameMatrixFactory.newGameMatrix(); AbstractTextFormatter formatter = newInstance(); formatter.setUnknownCellContentCharacter("?"); String actual = formatter.format(matrix); assertEquals( "?????????\n"+ "?????????\n"+ "?????????\n"+ "?????????\n"+ "?????????\n"+ "?????????\n"+ "?????????\n"+ "?????????\n"+ "?????????\n" , actual); }
@Override public String format(final GameMatrix matrix) { StringBuilder sb = new StringBuilder(); for (int row = 0; row < GameMatrix.SIZE; row++) { for (int column = 0; column < GameMatrix.SIZE; column++) { byte val = matrix.get(row, column); String str; if (val == GameMatrix.UNSET) { str = getUnknownCellContentCharacter(); } else { str = Integer.toString(val); } sb.append(str); } sb.append(getLineSeparator()); } return sb.toString(); }
PlainTextFormatter extends AbstractTextFormatter { @Override public String format(final GameMatrix matrix) { StringBuilder sb = new StringBuilder(); for (int row = 0; row < GameMatrix.SIZE; row++) { for (int column = 0; column < GameMatrix.SIZE; column++) { byte val = matrix.get(row, column); String str; if (val == GameMatrix.UNSET) { str = getUnknownCellContentCharacter(); } else { str = Integer.toString(val); } sb.append(str); } sb.append(getLineSeparator()); } return sb.toString(); } }
PlainTextFormatter extends AbstractTextFormatter { @Override public String format(final GameMatrix matrix) { StringBuilder sb = new StringBuilder(); for (int row = 0; row < GameMatrix.SIZE; row++) { for (int column = 0; column < GameMatrix.SIZE; column++) { byte val = matrix.get(row, column); String str; if (val == GameMatrix.UNSET) { str = getUnknownCellContentCharacter(); } else { str = Integer.toString(val); } sb.append(str); } sb.append(getLineSeparator()); } return sb.toString(); }  }
PlainTextFormatter extends AbstractTextFormatter { @Override public String format(final GameMatrix matrix) { StringBuilder sb = new StringBuilder(); for (int row = 0; row < GameMatrix.SIZE; row++) { for (int column = 0; column < GameMatrix.SIZE; column++) { byte val = matrix.get(row, column); String str; if (val == GameMatrix.UNSET) { str = getUnknownCellContentCharacter(); } else { str = Integer.toString(val); } sb.append(str); } sb.append(getLineSeparator()); } return sb.toString(); }  @Override String format(final GameMatrix matrix); }
PlainTextFormatter extends AbstractTextFormatter { @Override public String format(final GameMatrix matrix) { StringBuilder sb = new StringBuilder(); for (int row = 0; row < GameMatrix.SIZE; row++) { for (int column = 0; column < GameMatrix.SIZE; column++) { byte val = matrix.get(row, column); String str; if (val == GameMatrix.UNSET) { str = getUnknownCellContentCharacter(); } else { str = Integer.toString(val); } sb.append(str); } sb.append(getLineSeparator()); } return sb.toString(); }  @Override String format(final GameMatrix matrix);  }