@Test( expected = JSchException.class )
public void testAddHostKeyInKnownHostFile()
    throws JSchException
{

    Properties sessionConfig = new Properties();
    sessionConfig.put( "StrictHostKeyChecking", "no" );
    Session session = SshUtil.getSessionObject( "username", "password", "localhost", 22, sessionConfig );
    final String userHomeDir = System.getProperty( "user.home" );
    final String knownHostsFile = String.format( "%s%s.ssh/known_hosts", userHomeDir, File.separator );
    boolean hostKeyAdded = SshUtil.addHostKeyInKnownHostFile( session, knownHostsFile );
    assertTrue( hostKeyAdded );
}