@Test public void test_compareTo() { RuleKey aa = RuleKey.of("A", "A"); RuleKey ab = RuleKey.of("A", "B"); assertThat(ab).isGreaterThan(aa); assertThat(aa).isLessThan(ab); assertThat(aa).isNotEqualTo(ab); assertThat(ab).isNotEqualTo(aa); assertThat(aa).isEqualTo(aa); assertThat(ab).isEqualTo(ab); } }
@Test public void emptySources() { AtomicBoolean cancelled = new AtomicBoolean(); Mono<String> empty1 = Mono.empty(); Mono<String> empty2 = Mono.empty(); Mono<String> empty3 = Mono.<String>empty().delaySubscription(Duration.ofMillis(500)) .doOnCancel(() -> cancelled.set(true)); Duration d = StepVerifier.create(Mono.zip(empty1, empty2, empty3)) .verifyComplete(); assertThat(cancelled).isTrue(); assertThat(d).isLessThan(Duration.ofMillis(500)); }
@Test public void monoProcessorBlockNegativeIsImmediateTimeout() { long start = System.nanoTime(); assertThatExceptionOfType(IllegalStateException.class) .isThrownBy(() -> Mono.just("foo") .delayElement(Duration.ofMillis(500)) .toProcessor() .block(Duration.ofSeconds(-1))) .withMessage("Timeout on Mono blocking read"); assertThat(Duration.ofNanos(System.nanoTime() - start)) .isLessThan(Duration.ofMillis(500)); }
@Test void parseVersionWithSpaces() { assertThat(this.parser.parse(" 1.2.0.RC3 ")) .isLessThan(this.parser.parse("1.3.0.RELEASE")); }
@Test void compareLowerVersion() { assertThat(parse("1.0.5.RELEASE")).isLessThan(parse("1.1.9.RELEASE")); }
@Test void compareUnknownQualifier() { assertThat(parse("1.2.0.Beta")).isLessThan(parse("1.2.0.CR")); }
@Test void compareUnknownQualifierVersion() { assertThat(parse("1.2.0.Beta1")).isLessThan(parse("1.2.0.Beta2")); }
@Test void compareLessQualifierVersion() { assertThat(parse("1.2.0.RC2")).isLessThan(parse("1.2.0.RC3")); }
@Test void compareLowerQualifier() { assertThat(parse("1.2.0.RC1")).isLessThan(parse("1.2.0.RELEASE")); }
@Test void snapshotLowerThanRelease() { assertThat(parse("1.2.0.BUILD-SNAPSHOT")).isLessThan(parse("1.2.0.RELEASE")); }
@Test public void monoProcessorBlockZeroIsImmediateTimeout() { long start = System.nanoTime(); assertThatExceptionOfType(IllegalStateException.class) .isThrownBy(() -> Mono.just("foo") .delayElement(Duration.ofMillis(500)) .toProcessor() .block(Duration.ZERO)) .withMessage("Timeout on Mono blocking read"); assertThat(Duration.ofNanos(System.nanoTime() - start)) .isLessThan(Duration.ofMillis(500)); }
@Test(timeout = 5000L) public void emptyIsImmediate() { Mono<String> source = Mono.<String>empty().log().hide(); Duration d = StepVerifier.create(new MonoDelayElement<>(source, 10, TimeUnit.SECONDS, defaultSchedulerForDelay()).log()) .expectSubscription() .verifyComplete(); assertThat(d).isLessThan(Duration.ofSeconds(1)); }
@Test public void errorIsImmediate() { Mono<String> source = Mono.<String>error(new IllegalStateException("boom")).hide(); Duration d = StepVerifier.create(new MonoDelayElement<>(source, 10, TimeUnit.SECONDS, defaultSchedulerForDelay()).log()) .expectSubscription() .verifyErrorMessage("boom"); assertThat(d).isLessThan(Duration.ofSeconds(1)); }
public void test_comparisonWithSchemeSame() { StandardId id1 = StandardId.of(SCHEME, "123"); StandardId id2 = StandardId.of(SCHEME, "234"); // as schemes are same, will compare by id assertThat(id1).isLessThan(id2); }
@Test @SuppressWarnings("unchecked") public void testSmallValues() { String last=null; for (int i = -1000; i < 1000; i++) { String next = toLexSortableString(i); if( last != null ) { assertThat((Comparable)last).isLessThan(next); } last = next; } }
@Test public void zeroValue() throws Exception { assertThat(dataTypeToUI.zeroValue(Integer.class)).isEqualTo(0); assertThat(dataTypeToUI.zeroValue(Boolean.class)).isFalse(); assertThat(Duration.between(dataTypeToUI.zeroValue(LocalDateTime.class), LocalDateTime.now())).isLessThan(Duration.of(10L, ChronoUnit.MILLIS)); } }
@Test void compareToShouldReturnNegativeWhenComparedToNext() { assertThat(EventId.first()) .isLessThan(EventId.first().next()); }
@Test void compareToShouldReturnNegativeWhenComparedToNext() { assertThat(EventId.first()) .isLessThan(EventId.first().next()); }
@Test void compareToShouldReturnNegativeWhenComparedToNextWithPreviousCall() { assertThat(EventId.first().next().previous().get()) .isLessThan(EventId.first().next()); }
@Test void compareToShouldReturnNegativeWhenComparedToNextWithPreviousCall() { assertThat(EventId.first().next().previous().get()) .isLessThan(EventId.first().next()); }