//prepare GerritTrigger object with the escapeQuotes setting is on.
GerritTrigger triggerWithEscapeQuotesOn = Setup.createDefaultTrigger(null);
when(project.getTrigger(GerritTrigger.class)).thenReturn(triggerWithEscapeQuotesOn);
//the Trigger is creating parameters with escaped quote in "subject".
ParametersAction paremetersAction =
triggerWithEscapeQuotesOn.createParameters(eventWithQuotes, project);
ParameterValue strPara =
new StringParameterValue(GERRIT_CHANGE_SUBJECT.name(), stringWithQuotesEscaped);
verify(changeWithQuotes, times(1)).getSubject();
assertEquals(strPara, paremetersAction.getParameter(GERRIT_CHANGE_SUBJECT.name()));
//the Trigger is creating parameters without escaped quote in "subject".
paremetersAction = triggerWithEscapeQuotesOn.createParameters(eventWithoutQuotes, project);
strPara = new StringParameterValue(GERRIT_CHANGE_SUBJECT.name(), stringWithoutQuotes);
verify(changeWithoutQuotes, times(1)).getSubject();
assertEquals(strPara, paremetersAction.getParameter(GERRIT_CHANGE_SUBJECT.name()));
}