java - How can I unit test that I received correct PreparedStatement? -
i want pass in suitable object verify method, not any(). is there way it? i cannot take , copy lambda method , pass results verify. doesn't work because lambdas cannot tested directly. my unit test not close testing anything: @test public void testruntrigger() { campaigntrigger.updatecampaignstatus(); verify(jdbctemplate).update(any(preparedstatementcreator.class)); assertequals("update campaign set state = 'finished' state in ('paused','created','running') , campaign_end < ? ", campaigntrigger.update_campaign_sql); } and class i'm testing : @component @slf4j public class campaigntrigger { final string update_campaign_sql = string.format("update campaign set state = '%s' " + " state in (%s) , campaign_end < ? ", finished, stream.of(paused, created, running) .map(campaignstate::name) .collect(collectors.joining(&qu