KeyBinding implements Serializable { @JsonIgnore public KeyType[] asKeyTypes() { List<KeyType> combo = new ArrayList<>(); if (isNotBlank(keyCombo)) { for (String key : keyCombo.split(" ")) { KeyType type = KEY_MAP.get(key.toUpperCase(Locale.US)); combo.add(type); } } return combo.toArray(new KeyType[combo.size()]); } KeyBinding();  KeyBinding(String aKeyCombo, String aValue); String getKeyCombo(); void setKeyCombo(String aKeyCombo); String getValue(); void setValue(String aValue); @JsonIgnore boolean isValid(); @JsonIgnore KeyType[] asKeyTypes(); @JsonIgnore String asHtml();  }
@Test public void thatValidKeyBindingCanBeParsed() throws Exception { new KeyBinding("a", null).asKeyTypes(); new KeyBinding("alt f5", null).asKeyTypes(); new KeyBinding("shift enter", null).asKeyTypes(); new KeyBinding("ctrl space", null).asKeyTypes(); }