本文整理汇总了Java中org.assertj.core.api.SoftAssertions.assertAll方法的典型用法代码示例。如果您正苦于以下问题:Java SoftAssertions.assertAll方法的具体用法?Java SoftAssertions.assertAll怎么用?Java SoftAssertions.assertAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.assertj.core.api.SoftAssertions
的用法示例。
在下文中一共展示了SoftAssertions.assertAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldAddTags
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
void shouldAddTags() {
runClasses(TaggedTests.class);
final List<TestResult> testResults = results.getTestResults();
SoftAssertions softly = new SoftAssertions();
softly.assertThat(testResults)
.hasSize(1);
softly.assertThat(testResults)
.flatExtracting(TestResult::getLabels)
.filteredOn(label -> "tag".equals(label.getName()))
.flatExtracting(Label::getValue)
.containsExactlyInAnyOrder(CLASS_TAG, METHOD_TAG);
softly.assertAll();
}
示例2: applyCollectionTypes
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void applyCollectionTypes() throws Exception {
SoftAssertions softly = new SoftAssertions();
softly.assertThat(lookup.apply(
CollectionFields.class.getDeclaredField("stringList").getGenericType())
).isEqualTo(IndexType.TEXT);
softly.assertThat(lookup.apply(
CollectionFields.class.getDeclaredField("integerSet").getGenericType())
).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(
CollectionFields.class.getDeclaredField("stringArray").getGenericType())
).isEqualTo(IndexType.TEXT);
softly.assertThat(lookup.apply(
CollectionFields.class.getDeclaredField("intArray").getGenericType())
).isEqualTo(IndexType.NUMBER);
softly.assertAll();
}
示例3: verifyTestEntityCollectionSaved
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@SuppressWarnings("Duplicates")
protected void verifyTestEntityCollectionSaved() {
SoftAssertions softly = new SoftAssertions();
TestLongEntity loaded1 = load(1L);
softly.assertThat(loaded1.getId()).isEqualTo(1L);
softly.assertThat(loaded1.getName()).isEqualTo("entity1");
TestLongEntity loaded2 = load(2L);
softly.assertThat(loaded2.getId()).isEqualTo(2L);
softly.assertThat(loaded2.getName()).isEqualTo("entity2");
TestLongEntity loaded3 = load(3L);
softly.assertThat(loaded3.getId()).isEqualTo(3L);
softly.assertThat(loaded3.getName()).isEqualTo("entity3");
softly.assertAll();
}
示例4: verifyTestEntityCollectionSaved
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@SuppressWarnings("Duplicates")
protected void verifyTestEntityCollectionSaved() {
SoftAssertions softly = new SoftAssertions();
TestStringEntity loaded1 = load("id1");
softly.assertThat(loaded1.getId()).isEqualTo("id1");
softly.assertThat(loaded1.getName()).isEqualTo("entity1");
TestStringEntity loaded2 = load("id2");
softly.assertThat(loaded2.getId()).isEqualTo("id2");
softly.assertThat(loaded2.getName()).isEqualTo("entity2");
TestStringEntity loaded3 = load("id3");
softly.assertThat(loaded3.getId()).isEqualTo("id3");
softly.assertThat(loaded3.getName()).isEqualTo("entity3");
softly.assertAll();
}
示例5: verifyTestEntityCollectionSaved
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
protected void verifyTestEntityCollectionSaved() {
SoftAssertions softly = new SoftAssertions();
TestLongEntity loaded1 = load(1L);
softly.assertThat(loaded1.getId()).isEqualTo(1L);
softly.assertThat(loaded1.getName()).isEqualTo("entity1");
TestLongEntity loaded2 = load(2L);
softly.assertThat(loaded2.getId()).isEqualTo(2L);
softly.assertThat(loaded2.getName()).isEqualTo("entity2");
TestLongEntity loaded3 = load(3L);
softly.assertThat(loaded3.getId()).isEqualTo(3L);
softly.assertThat(loaded3.getName()).isEqualTo("entity3");
softly.assertAll();
}
示例6: test_lineSeparator_suffix
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void test_lineSeparator_suffix() {
// Create the log event.
SimpleMessage message = new SimpleMessage("Hello, World!");
LogEvent logEvent = Log4jLogEvent
.newBuilder()
.setLoggerName(LogstashLayoutTest.class.getSimpleName())
.setLevel(Level.INFO)
.setMessage(message)
.build();
// Check line separators.
SoftAssertions assertions = new SoftAssertions();
test_lineSeparator_suffix(logEvent, true, assertions);
test_lineSeparator_suffix(logEvent, false, assertions);
assertions.assertAll();
}
示例7: of_WHEN_valid_block_is_passed_RETURN_new_block
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void of_WHEN_valid_block_is_passed_RETURN_new_block() throws Exception {
// Given
GeneralBlock generalBlock = new GeneralBlock(UserHeaderBlock.BLOCK_ID_3, "{113:SEPA}{108:ILOVESEPA}");
// When
UserHeaderBlock block = UserHeaderBlock.of(generalBlock);
// Then
assertThat(block).isNotNull();
SoftAssertions softly = new SoftAssertions();
softly.assertThat(block.getBankingPriorityCode()).contains("SEPA");
softly.assertThat(block.getMessageUserReference()).contains("ILOVESEPA");
softly.assertAll();
}
示例8: test
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void test() {
// GIVEN
final Car car = new Car();
final Integer numberOfDoors_expected = 5;
final int numberOfSeats_expected = 4;
car.design(numberOfDoors_expected);
car.design(numberOfSeats_expected);
// WHEN
final Integer numberOfDoors = car.getNumberOfDoors();
final int numberOfSeats = car.getNumberOfSeats();
// THEN
SoftAssertions softly = new SoftAssertions();
softly.assertThat(numberOfDoors).isEqualTo(numberOfDoors_expected);
softly.assertThat(numberOfSeats).isEqualTo(numberOfSeats_expected);
softly.assertAll();
}
示例9: assertResultIsValid
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
private static void assertResultIsValid(VisitationResult result, PersonFields field, Person person) {
SoftAssertions soft = new SoftAssertions();
soft.assertThat(result).as("result").isNotNull();
if (result != null) {
soft.assertThat(result.getValue()).as("result.value").isSameAs(field.getValue(person));
soft.assertThat(result.getFieldContext()).as("result.fieldContext").isNotNull();
if (result.getFieldContext() != null) {
soft.assertThat(result.getFieldContext().getField()).as("result.fieldContext.field")
.isSameAs(field.getField());
}
List<PersonFields> notVisitables = Arrays.asList(PersonFields.NAME, PersonFields.ANNUALSALARY, PersonFields.BIRTHDAY, PersonFields.EMPTY_ENUM);
soft.assertThat(result.isVisitOfValueRequired()).as("result.visitOfValueRequired")
.isEqualTo(!notVisitables.contains(field));
}
soft.assertAll();
}
示例10: of_WHEN_valid_block_is_passed_RETURN_new_block
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void of_WHEN_valid_block_is_passed_RETURN_new_block() throws Exception {
// Given
GeneralBlock generalBlock = new GeneralBlock(BasicHeaderBlock.BLOCK_ID_1, "F01YOURCODEZABC2222777777");
// When
BasicHeaderBlock block = BasicHeaderBlock.of(generalBlock);
// Then
assertThat(block).isNotNull();
SoftAssertions softly = new SoftAssertions();
softly.assertThat(block.getApplicationId()).isEqualTo("F");
softly.assertThat(block.getServiceId()).isEqualTo("01");
softly.assertThat(block.getLogicalTerminalAddress()).isEqualTo("YOURCODEZABC");
softly.assertThat(block.getSessionNumber()).isEqualTo("2222");
softly.assertThat(block.getSequenceNumber()).isEqualTo("777777");
softly.assertAll();
}
示例11: test_equals_isTransitive
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
// if x.equals(z) and y.equals(z) is true then x.equals(y) is true
public void test_equals_isTransitive() {
// GIVEN
final UniSubject x = new UniSubject("Math", "Joe", 2016);
final UniSubject y = new UniSubject("Math", "Joe", 2016);
final UniSubject z = new UniSubject("Math", "Joe", 2016);
// WHEN
boolean xEqualsZ = x.equals(z);
boolean yEqualsZ = y.equals(z);
boolean xEqualsY = x.equals(y);
// THEN
final SoftAssertions softly = new SoftAssertions();
softly.assertThat(xEqualsZ).isTrue();
softly.assertThat(yEqualsZ).isTrue();
softly.assertThat(xEqualsY).isTrue();
softly.assertAll();
}
示例12: of_WHEN_valid_block_is_passed_RETURN_new_block
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void of_WHEN_valid_block_is_passed_RETURN_new_block() throws Exception {
// Given
GeneralBlock generalBlock = new GeneralBlock(SystemTrailerBlock.BLOCK_ID_S, "{CHK:F7C4F89AF66D}{TNG:}{SAC:}{COP:P}");
// When
SystemTrailerBlock block = SystemTrailerBlock.of(generalBlock);
// Then
assertThat(block).isNotNull();
SoftAssertions softly = new SoftAssertions();
softly.assertThat(block.getChecksum()).contains("F7C4F89AF66D");
softly.assertThat(block.getTraining()).contains("");
softly.assertThat(block.getAdditionalSubblocks("COP").getContent()).isEqualTo("P");
softly.assertAll();
}
示例13: addDefaultMappings
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void addDefaultMappings() throws Exception {
SoftAssertions softly = new SoftAssertions();
softly.assertThat(lookup.apply(boolean.class)).isEqualTo(IndexType.IDENTIFIER);
softly.assertThat(lookup.apply(Boolean.class)).isEqualTo(IndexType.IDENTIFIER);
softly.assertThat(lookup.apply(Enum.class)).isEqualTo(IndexType.IDENTIFIER);
softly.assertThat(lookup.apply(UUID.class)).isEqualTo(IndexType.IDENTIFIER);
softly.assertThat(lookup.apply(Short.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(Integer.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(short.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(int.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(Integer.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(Number.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(long.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(Long.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(float.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(Float.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(double.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(Double.class)).isEqualTo(IndexType.NUMBER);
softly.assertThat(lookup.apply(CharSequence.class)).isEqualTo(IndexType.TEXT);
softly.assertThat(lookup.apply(OffsetDateTime.class)).isEqualTo(IndexType.DATE);
softly.assertThat(lookup.apply(ZonedDateTime.class)).isEqualTo(IndexType.DATE);
softly.assertThat(lookup.apply(Date.class)).isEqualTo(IndexType.DATE);
softly.assertThat(lookup.apply(GeoPoint.class)).isEqualTo(IndexType.GEOPOINT);
softly.assertAll();
}
示例14: apply_willReturnCorrectType_whenPassedASubclassOfAKnownType
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void apply_willReturnCorrectType_whenPassedASubclassOfAKnownType() throws Exception {
SoftAssertions softly = new SoftAssertions();
softly.assertThat(lookup.apply(String.class)).isEqualTo(IndexType.TEXT);
softly.assertThat(lookup.apply(SomeEnum.class)).isEqualTo(IndexType.IDENTIFIER);
softly.assertAll();
}
示例15: apply
import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
base.evaluate();
SoftAssertions softly = new SoftAssertions();
for (int i = 0; i < messages.size(); i++) {
softly.assertThat(messages.get(i)).matches(expectedMessages.get(i));
}
softly.assertAll();
}
};
}