StringTableCellEditor extends DefaultCellEditor { @Override public boolean stopCellEditing() { try { ValueXmlHelper.escapeResourceStringAsXml((String)getCellEditorValue()); return super.stopCellEditing(); } catch (IllegalArgumentException exception) { getComponent().setBorder(new LineBorder(JBColor.RED)); return false; } } StringTableCellEditor(); @VisibleForTesting  StringTableCellEditor(@NotNull JTextField component); @VisibleForTesting void setCellEditorValue(@NotNull Object value); @Override JTextComponent getComponent(); @NotNull @Override Component getTableCellEditorComponent(@NotNull JTable table, @NotNull Object value, boolean selected, int row, int column); @Override boolean stopCellEditing();  }
@Test public void stopCellEditing() { Mockito.when(myComponent.getText()).thenReturn("https: assertFalse(new StringTableCellEditor(myComponent).stopCellEditing()); Mockito.verify(myComponent).setBorder(ArgumentMatchers.<LineBorder>argThat( actual -> JBColor.RED.equals(actual.getLineColor()) && 1 == actual.getThickness() && !actual.getRoundedCorners())); }