![JAR search and dependency download from the Maven repository](/logo.png)
com.insightfullogic.lambdabehave.impl.Blocks Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lambda-behave Show documentation
Show all versions of lambda-behave Show documentation
A modern testing and behavioural specification framework for Java 8
package com.insightfullogic.lambdabehave.impl;
import com.insightfullogic.lambdabehave.Block;
import com.insightfullogic.lambdabehave.impl.reports.SpecificationReport;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
public class Blocks {
private final String suiteName;
private final List blocks;
public Blocks(final String suiteName) {
this.suiteName = suiteName;
blocks = new ArrayList<>();
}
public void add(final Block block) {
blocks.add(block);
}
public Optional runAll(final String description) {
try {
for (Block block : blocks) {
block.run();
}
return Optional.empty();
} catch (final Exception e) {
return Optional.of(SpecificationReport.error(description, e));
}
}
public Stream completeFixtures(final String description) {
return blocks.stream()
.map(block -> new CompleteFixture(suiteName, description, block));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy