Consider the following method:
/** * Set whether messages are printed to System.out. * * @param printOutput True to print, false for silent logging */ public void setPrintOutput(boolean printOutput) { // Synchronize to messages because this field is used when a message is received synchronized (messages) { this.printOutput = printOutput; } }
This method is part of a set of several methods that include messages, so I want to write a test that checks that this method is synchronized to messages. Does anyone know how I will do this?
messages
I think this is beyond the scope of unit testing, because the entire synchronization point is designed to provide a certain type of connection between two remote code fragments.
, messages, , null, . , .
unit test, message , , ( -, ). @biziclop, . , , , - .
message
Source: https://habr.com/ru/post/1792312/More articles:How are Android market apps connected - androidMediaElement Not Displaying - .netSelect the lowest price from the database row and ignore zero or 0 - databaseCross-browser clipping masks - cssUnable to incrementally expand WPF window - wpfHow can I programmatically clear my ActiveMQ queue using the Apache.NMS API? - activemqHow to write a file to the response stream and show / hide the "Working" modal window? - jqueryAndroid bluetooth. Determine if the paired device is set to 'on' - androidreturn pdf response from stdout with Django - pythonEntering date ranges in SQL Server 2005 - sql-server-2005All Articles