I am using the BasicJTableCellWriter to fill a swing table. I recover the initial values, set some new ones, then I would like to restore the table to its initial state. Some of the fields had no value at all, and their value is therefore stored as an empty string.
However, when executing the following:
BasicJTableCellWriter writer = new BasicJTableCellWriter(this.robot);
writer.enterValue(table.target(), 0, 0, "");
the call throws an exception,
java.lang.IllegalArgumentException: Argument expected not to be empty!
at org.assertj.core.util.Preconditions.throwExceptionForBeingEmpty(Preconditions.java:107)
at org.assertj.core.util.Preconditions.checkNotNullOrEmpty(Preconditions.java:49)
at org.assertj.core.util.Preconditions.checkNotNullOrEmpty(Preconditions.java:34)
at org.assertj.swing.driver.JTextComponentDriver.replaceText(JTextComponentDriver.java:113)
at org.assertj.swing.driver.JTableTextComponentEditorCellWriter.enterValue(JTableTextComponentEditorCellWriter.java:51)
at org.assertj.swing.driver.BasicJTableCellWriter.enterValue(BasicJTableCellWriter.java:66)
I don't really understand the point of this check. The field is a standard textbox, and an empty value should be completely ok. The guilty part of the code seems to be the fact that the method enterValue from JTableTextComponentEditorCellWriter calls the replaceText from JTextComponentDriver. The method deleteText is not accessible from the Cell Writer.
I think there should either be another method, maybe deleteValue, for the CellWriter, or that the method enterValue should handle the empty string case and call deleteText. Or am I missing something in the way to edit tables?
Hi,
I am using the
BasicJTableCellWriter
to fill a swing table. I recover the initial values, set some new ones, then I would like to restore the table to its initial state. Some of the fields had no value at all, and their value is therefore stored as an empty string.However, when executing the following:
the call throws an exception,
I don't really understand the point of this check. The field is a standard textbox, and an empty value should be completely ok. The guilty part of the code seems to be the fact that the method
enterValue
fromJTableTextComponentEditorCellWriter
calls thereplaceText
fromJTextComponentDriver
. The methoddeleteText
is not accessible from the Cell Writer.I think there should either be another method, maybe
deleteValue
, for the CellWriter, or that the methodenterValue
should handle the empty string case and calldeleteText
. Or am I missing something in the way to edit tables?Thanks in advance,