Skip to content

Commit

Permalink
add: Asserts#assertEventually( Duration duration, Duration retryInter…
Browse files Browse the repository at this point in the history
…val, oap.util.function.Try.ThrowingRunnable asserts )
  • Loading branch information
galaxina committed Sep 27, 2023
1 parent 486ae25 commit e04ac65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion oap-stdlib/src/main/java/oap/testng/Asserts.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.lang.reflect.Method;
import java.net.URL;
import java.nio.file.Path;
import java.time.Duration;
import java.util.Map;

import static java.util.stream.Collectors.toList;
Expand Down Expand Up @@ -76,11 +77,15 @@ public static void eventually( long retryTimeout, int retries, Try.ThrowingRunna
else throw new AssertionError( "timeout" );
}

@SneakyThrows
public static void assertEventually( long retryTimeout, int retries, oap.util.function.Try.ThrowingRunnable asserts ) {
eventually( retryTimeout, retries, asserts );
}

public static void assertEventually( Duration duration, Duration retryInterval, oap.util.function.Try.ThrowingRunnable asserts ) {
int retries = ( int ) ( duration.toMillis() / retryInterval.toMillis() );
eventually( retryInterval.toMillis(), retries, asserts );
}

@Deprecated
public static <A> void assertEquals( java.util.stream.Stream<? extends A> actual, java.util.stream.Stream<? extends A> expected ) {
if( actual == null && expected != null ) fail( "actual stream is null" );
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<properties>

<oap.project.version>18.11.8</oap.project.version>
<oap.project.version>18.11.9</oap.project.version>

<oap.deps.testng.version>7.8.0</oap.deps.testng.version>
<oap.deps.assertj.version>3.24.2</oap.deps.assertj.version>
Expand Down

0 comments on commit e04ac65

Please sign in to comment.