### Question:
PackageNameWhiteListSaver implements SupportsUpdate<WhiteList> { @Override public Path save( final Path path, final WhiteList content, final Metadata metadata, final String comment ) { try { ioService.write( Paths.convert( path ), toString( content ), metadataService.setUpAttributes( path, metadata ), commentedOptionFactory.makeCommentedOption( comment ) ); return path; } catch ( Exception e ) { throw ExceptionUtilities.handleException( e ); } } PackageNameWhiteListSaver(); @Inject  PackageNameWhiteListSaver( final @Named( "ioStrategy" ) IOService ioService,
                                      final MetadataServerSideService metadataService,
                                      final CommentedOptionFactory commentedOptionFactory ); @Override Path save( final Path path,
                      final WhiteList content,
                      final Metadata metadata,
                      final String comment );  }### Answer:
@Test public void testSave() throws Exception { final Path path = testFileSystem.createTempFile( "whitelist" ); final WhiteList whiteList = new WhiteList(); whiteList.add( "org.drools" ); whiteList.add( "org.guvnor" ); final Metadata metadata = new Metadata(); final String comment = "comment"; final HashMap<String, Object> attributes = new HashMap<String, Object>(); when( metadataService.setUpAttributes( path, metadata ) ).thenReturn( attributes ); final CommentedOption commentedOption = mock( CommentedOption.class ); when( commentedOptionFactory.makeCommentedOption( "comment" ) ).thenReturn( commentedOption ); saver.save( path, whiteList, metadata, comment ); ArgumentCaptor<String> whiteListTextArgumentCaptor = ArgumentCaptor.forClass( String.class ); verify( ioService ).write( any( org.uberfire.java.nio.file.Path.class ), whiteListTextArgumentCaptor.capture(), eq( attributes ), eq( commentedOption ) ); final String whiteListAsText = whiteListTextArgumentCaptor.getValue(); assertTrue( whiteListAsText.contains( "org.drools" ) ); assertTrue( whiteListAsText.contains( "org.guvnor" ) ); }