Capturing arguments with mockito

EncryptedFileInfo info = cut.storeEncryptedFile(encryptionSecret, plainContents, fileName);

ArgumentCaptor<byte[]> argument = ArgumentCaptor.forClass(byte[].class);

verify(cut).createFileAndAdd(eq(fileName), argument.capture());
byte[] encryptedContent = argument.getAllValues().get(0);

Where intercepted method is:

void createFileAndAdd(String fileName, byte[] encryptedContents);

Get java.util.logging working on UnitTesting

If you need to active the java.util.logging on your test, you can achieve it just adding the vm option
-Djava.util.logging.config.file=/path/to/logging.properties

where logging.properties can be something like

handlers = java.util.logging.ConsoleHandler
.level=INFO
your.package.level = FINE
java.util.logging.ConsoleHandler.level = FINE

You can find a more complete example on https://svn.apache.org/repos/asf/river/jtsk/skunk/surrogate/testfiles/logging.properties

,