Skip to content

Tag: java

how to test Comparator at junit test

I need to test this method – compare(). Can You get advice? How better I can do this(all part if, else-if, else). After this recomendations – we have next picture (Thank YOU guys a lot!): All is normal testing now. Answer Just instantiate your comparator class and pass in objects:

MySQL Batchupdate() with ON DUPLICATE KEY UPDATE

I am using batchUpdate() to insert multiple records in a table. As per the requirement, if there is a duplicate value for a primary key while inserting it should be updated with the latest received data, hence I was trying to use ON DUPLICATE KEY UPDATE in INSERT statement. The ON DUPLICATE KEY UPDATE works g…

Eclipse autogenerated toString() method

As par as I know concatinate String using + sign is not a good practice when you have large number of String. But when I check on eclipse generated toString() method (Write click on source file -> Source -> Generate toString() ) it has the same. Is there any place to configure like my expected toString(…