PentahoVersionCheckReflectHelper { public static String logVersionCheck( final List results, final Log logger ) { String output = null; if ( ( results != null ) && ( results.size() > 0 ) ) { String result = results.get( 0 ).toString(); try { Document doc = XmlDom4JHelper.getDocFromString( result, new PentahoEntityResolver() ); if ( doc != null ) { List nodes = doc.selectNodes( " Iterator nodeIter = nodes.iterator(); while ( nodeIter.hasNext() ) { Element updateElement = (Element) nodeIter.next(); String title = updateElement.attributeValue( "title" ); String version = updateElement.attributeValue( "version" ); String type = updateElement.attributeValue( "type" ); String downloadurl = XmlDom4JHelper.getNodeText( "downloadurl", updateElement ); if ( downloadurl != null ) { downloadurl = downloadurl.trim(); } logger.info( Messages.getInstance().getString( "VersionCheck.UPDATE_MESSAGE", title, version, type, downloadurl ) ); } nodes = doc.selectNodes( " nodeIter = nodes.iterator(); while ( nodeIter.hasNext() ) { Element errorElement = (Element) nodeIter.next(); String message = errorElement.getText(); logger.info( Messages.getInstance().getString( "VersionCheck.ERROR_MESSAGE", message ) ); } } output = result; } catch ( Exception e ) { output = "<vercheck><error><[!CDATA[" + Messages.getInstance().getString( "VersionCheck.ERROR_MESSAGE", e.getMessage() ) + "]]></error></vercheck>"; } } else { output = "<vercheck><error><[!CDATA[" + Messages.getInstance().getString( "VersionCheck.NO_RESULT_MESSAGE" ) + "]]></error></vercheck>"; } return output; }  static boolean isVersionCheckerAvailable(); static List performVersionCheck( final boolean ignoreExistingUpdates, final int versionRequestFlags ); static String logVersionCheck( final List results, final Log logger );  }
@Test public void logVersionCheckTest() { Log mockLog = Mockito.mock( Log.class ); List<String> results = new ArrayList<>(); results.add( XML_TEXT ); PentahoVersionCheckReflectHelper.logVersionCheck( results, mockLog ); verify( mockLog, times( 2 ) ).info( anyObject() ); }