KeyBinding implements Serializable { @JsonIgnore public boolean isValid() { if (isBlank(keyCombo)) { return false; } for (String key : keyCombo.split(" ")) { KeyType type = KEY_MAP.get(key.toUpperCase(Locale.US)); if (type == null) { return false; } } return true; } 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 thatInvalidKeyBindingCanBeParsed() { assertThat(new KeyBinding("foo bar", null).isValid()).isFalse(); }