use of cucumber.api.java.After in project hippo by NHS-digital-website.
the class TestDataSteps method discardEditedDocument.
/**
* <p>
* Closes the current publication discarding current changes.
* </p><p>
* Only applicable to scenarios that leave the document in editable state; implemented as an {@linkplain After}
* hook rather than a step because this is really a test cleanup/tear-down activity that doesn't warrant expressing
* explicitly as a scenario step.
* </p><p>
* To ensure that this method gets called at the end of your scenario, tag the scenario with
* {@code @DiscardAfter}.
* </p>
*/
@After(value = "@DiscardAfter", order = 500)
public void discardEditedDocument() throws Throwable {
Publication currentPublication = testDataRepo.getCurrentPublication();
if (currentPublication != null) {
final String currentPublicationName = currentPublication.getName();
log.debug("Discarding and closing current publication: {}.", currentPublicationName);
contentPage.discardUnsavedChanges(currentPublicationName);
}
Dataset dataset = testDataRepo.getDataset();
if (dataset != null) {
String datasetName = dataset.getName();
log.debug("Discarding and closing current dataset: {}.", datasetName);
contentPage.discardUnsavedChanges(datasetName);
}
PublicationSeries series = testDataRepo.getPublicationSeries();
if (series != null) {
final String currentSeriesName = series.getName();
log.debug("Discarding and closing current series: {}.", currentSeriesName);
contentPage.discardUnsavedChanges(currentSeriesName);
}
PublicationArchive archive = testDataRepo.getPublicationArchive();
if (archive != null) {
final String currentArchiveName = archive.getName();
log.debug("Discarding and closing current archive: {}.", currentArchiveName);
contentPage.discardUnsavedChanges(currentArchiveName);
}
}
use of cucumber.api.java.After in project cucumber-jvm by cucumber.
the class JavaHookTest method hook_order_gets_registered.
@Test
public void hook_order_gets_registered() {
objectFactory.setInstance(new HasHooks());
backend.buildWorld();
backend.addHook(AFTER.getAnnotation(After.class), AFTER);
HookDefinition hookDef = glue.getAfterHooks().get(0);
assertEquals(1, hookDef.getOrder());
}
Aggregations