@Test public void testKeyFormat() throws Exception { initController(); String key = "12345678"; String formatted = controller.formatKey(key); assertEquals(formatted, "1234 5678"); }
String formatKey(String keyIdentifier) { char[] chars = keyIdentifier.toCharArray(); StringBuilder formatted = new StringBuilder(); for (int i = 0; i < chars.length; i++) { if (i > 0 && i%4 == 0) { formatted.append(" "); } formatted.append(chars[i]); } return formatted.toString(); }
AssignContactController extends AbstractController implements Initializable { String formatKey(String keyIdentifier) { char[] chars = keyIdentifier.toCharArray(); StringBuilder formatted = new StringBuilder(); for (int i = 0; i < chars.length; i++) { if (i > 0 && i%4 == 0) { formatted.append(" "); } formatted.append(chars[i]); } return formatted.toString(); } }
AssignContactController extends AbstractController implements Initializable { String formatKey(String keyIdentifier) { char[] chars = keyIdentifier.toCharArray(); StringBuilder formatted = new StringBuilder(); for (int i = 0; i < chars.length; i++) { if (i > 0 && i%4 == 0) { formatted.append(" "); } formatted.append(chars[i]); } return formatted.toString(); }  }
AssignContactController extends AbstractController implements Initializable { String formatKey(String keyIdentifier) { char[] chars = keyIdentifier.toCharArray(); StringBuilder formatted = new StringBuilder(); for (int i = 0; i < chars.length; i++) { if (i > 0 && i%4 == 0) { formatted.append(" "); } formatted.append(chars[i]); } return formatted.toString(); }  @Override void initialize(URL location, ResourceBundle resources); }
AssignContactController extends AbstractController implements Initializable { String formatKey(String keyIdentifier) { char[] chars = keyIdentifier.toCharArray(); StringBuilder formatted = new StringBuilder(); for (int i = 0; i < chars.length; i++) { if (i > 0 && i%4 == 0) { formatted.append(" "); } formatted.append(chars[i]); } return formatted.toString(); }  @Override void initialize(URL location, ResourceBundle resources); @FXML
    public ImageView keyIcon; @FXML
    public Label keyLabel; }