File file = new File( url.getFile()
+ ".metadata/.plugins/org.eclipse.core.runtime/.settings/org.apache.directory.studio.connection.core.prefs" );
assertFalse( file.exists() );
// open preferences dialog
PreferencesBot preferencesBot = studioBot.openPreferences();
assertTrue( preferencesBot.isVisible() );
// open certificate validation page
CertificateValidationPreferencePageBot pageBot = preferencesBot.openCertificatValidationPage();
assertTrue( pageBot.isValidateCertificatesSelected() );
// deselect certificate validation
pageBot.setValidateCertificates( false );
assertFalse( pageBot.isValidateCertificatesSelected() );
// click OK, this should write the property to the file
preferencesBot.clickOkButton();
assertTrue( file.exists() );
List<String> lines = FileUtils.readLines( file );
assertTrue( lines.contains( "validateCertificates=false" ) );
// open dialog again, check that certificate validation checkbox is not selected
preferencesBot = studioBot.openPreferences();
pageBot = preferencesBot.openCertificatValidationPage();
assertFalse( pageBot.isValidateCertificatesSelected() );
// restore defaults, this should select the certificate validation
pageBot.clickRestoreDefaultsButton();
assertTrue( pageBot.isValidateCertificatesSelected() );
// click OK, this should remove the property file as only defaults are set
preferencesBot.clickOkButton();
assertFalse( file.exists() );
}