Adding equality checkers


I'd like to add a new equality checker for a MolValue for use in the Table Difference Checker. 

A molfile contains a timestamp which will be different each time I node is run and I want to exclude this in the comparison. 

Is this something I can extend my end without changes to any core functionality?



Sure :-) Have a look a the extension point org.knime.testing.DifferenceCheckerFactory. org.knime.testing itself contains a few examples in the package org.knime.testing.internal.diffcheckers.

Thanks Thor, all implemented :). 

I used the StringChecker as a reference and unfortunately seem to have found a bug, if selecting the option it ignore line feeds the comparitor is actualy comparing the expected value against itself. 


Lines 114-116

if (m_ignoreLinefeeds.getBooleanValue()) {
            BufferedReader rA = new BufferedReader(new StringReader(valueA.getStringValue()));
            BufferedReader rB = new BufferedReader(new StringReader(valueA.getStringValue()));


the last line should probably be:

BufferedReader rB = new BufferedReader(new StringReader(valueB.getStringValue()));


The other issue I'm having relates to the "ignore timestamp line" dialog option I've added. The value of this setting is properly tracked as long as the Table Difference Checker hasn't failed. In the following scenario the bug occurs:


  1. Set dialog option "Ignore timestamp line" to false
  2. Execute node with differeing timestamped MolValues so node fails
  3. Open dialog and check "Ignore timestamp line"
  4. Execute node which now passes
  5. Open dialog and uncheck "Ignore timestamp line"
  6. Close dialog
  7. Open dialog and "Ignore timestamp line" option is still checked

The bug doesn't happen if I replace the default to be false instead of true.

// Bug occurs
private final SettingsModelBoolean m_ignoreTimeStampLine = new SettingsModelBoolean("ignoreTimestampLine", true);

// Bug does not occur	
private final SettingsModelBoolean m_ignoreTimeStampLine = new SettingsModelBoolean("ignoreTimestampLine", false);


However this doesn't seem to be the only time it fails. I've taken a video of the behaviour:

When default value is true (bug):

When default value is false (no bug):

Download URL as the video quality seems to have been reduced by Google drive:





Yikes. Copy&paste...

As for the weird dialog behaviour: as soon as you click on the dropdown list for the checker type, a new checker with default configuration is instantiated. If you want to see the current configuration, click on the first column in the table and not the second one. Then the correct configuration should be shown.

Ah whoops, thanks :).