本文整理了Java中org.assertj.core.api.ListAssert.usingComparatorForElementFieldsWithType()
方法的一些代码示例,展示了ListAssert.usingComparatorForElementFieldsWithType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListAssert.usingComparatorForElementFieldsWithType()
方法的具体详情如下:
包路径:org.assertj.core.api.ListAssert
类名称:ListAssert
方法名:usingComparatorForElementFieldsWithType
暂无
代码示例来源:origin: azkaban/azkaban
private void assertTriggerInstancesEqual(final TriggerInstance actual,
final TriggerInstance expected, final boolean ignoreFlowTrigger) {
if (!ignoreFlowTrigger) {
if (actual.getFlowTrigger() != null && expected.getFlowTrigger() != null) {
assertThat(actual.getFlowTrigger().toString())
.isEqualToIgnoringWhitespace(expected.getFlowTrigger().toString());
} else {
assertThat(actual.getFlowTrigger()).isNull();
assertThat(expected.getFlowTrigger()).isNull();
}
}
assertThat(actual).isEqualToIgnoringGivenFields(expected, "depInstances", "flowTrigger");
assertThat(actual.getDepInstances())
.usingComparatorForElementFieldsWithType((d1, d2) -> {
if (d1 == null && d2 == null) {
return 0;
} else if (d1 != null && d2 != null && d1.getTime() == d2.getTime()) {
return 0;
} else {
return -1;
}
}, Date.class)
.usingElementComparatorIgnoringFields("triggerInstance", "context")
.containsExactlyInAnyOrder(expected.getDepInstances()
.toArray(new DependencyInstance[expected.getDepInstances().size()]));
}
代码示例来源:origin: kiegroup/optaweb-employee-rostering
@Test
public void testCrudShiftTemplate() {
Spot spot = createSpot("spot");
Employee rotationEmployee = createEmployee("rotationEmployee");
Duration startOffset = Duration.ofDays(1);
Duration shiftDuration = Duration.ofHours(8);
ShiftTemplateView testAddShiftTemplate = createShiftTemplate(spot, null, startOffset, shiftDuration);
rotationRestService.addShiftTemplate(TENANT_ID, testAddShiftTemplate);
assertClientResponseOk();
List<ShiftTemplateView> shiftTemplates = rotationRestService.getShiftTemplateList(TENANT_ID);
assertClientResponseOk();
assertThat(shiftTemplates)
.usingComparatorForElementFieldsWithType(Comparator.naturalOrder(), Integer.class)
.usingComparatorForElementFieldsWithType(Comparator.naturalOrder(), Long.class)
.usingComparatorForElementFieldsWithType(Comparator.naturalOrder(), Duration.class)
.usingElementComparatorIgnoringFields(IGNORED_FIELDS)
.containsExactly(testAddShiftTemplate);
ShiftTemplateView testUpdateShiftTemplate = shiftTemplates.get(0);
testUpdateShiftTemplate.setRotationEmployeeId(rotationEmployee.getId());
rotationRestService.updateShiftTemplate(TENANT_ID, testUpdateShiftTemplate);
ShiftTemplateView retrievedShiftTemplate = rotationRestService.getShiftTemplate(TENANT_ID, testUpdateShiftTemplate.getId());
assertClientResponseOk();
assertThat(retrievedShiftTemplate).isNotNull().isEqualToIgnoringGivenFields(testUpdateShiftTemplate, IGNORED_FIELDS);
boolean result = rotationRestService.removeShiftTemplate(TENANT_ID, retrievedShiftTemplate.getId());
assertThat(result).isTrue();
assertClientResponseOk();
shiftTemplates = rotationRestService.getShiftTemplateList(TENANT_ID);
assertThat(shiftTemplates).isEmpty();
}
代码示例来源:origin: kiegroup/optaweb-employee-rostering
assertClientResponseOk();
assertThat(shifts)
.usingComparatorForElementFieldsWithType(Comparator.naturalOrder(), Integer.class)
.usingComparatorForElementFieldsWithType(Comparator.naturalOrder(), Long.class)
.usingComparatorForElementFieldsWithType(Comparator.naturalOrder(), LocalDateTime.class)
.usingElementComparatorOnFields(SHIFT_VIEW_NON_INDICTMENT_FIELDS)
.containsExactly(testAddShift);
代码示例来源:origin: io.vertx/vertx-micrometer-metrics
.usingComparatorForElementFieldsWithType(new DoubleComparator(0.1), Double.class)
.contains(dp("vertx.pool.usage[pool_name=test-worker,pool_type=worker]$MAX", sleepMillis / 1000d));
.usingComparatorForElementFieldsWithType(new GreaterOrEqualsComparator(), Double.class)
.contains(
dp("vertx.pool.usage[pool_name=test-worker,pool_type=worker]$TOTAL_TIME", taskCount * sleepMillis / 1000d));
代码示例来源:origin: io.vertx/vertx-micrometer-metrics
.usingComparatorForElementFieldsWithType(new DoubleComparator(1.0), Double.class)
.contains(
dp("vertx.eventbus.processingTime[address=testSubject]$TOTAL_TIME", 180d * instances / 1000d),
内容来源于网络,如有侵权,请联系作者删除!