mirror of
https://github.com/square/okhttp.git
synced 2025-07-31 05:04:26 +03:00
Use more AssertJ features
This commit is contained in:
@ -19,7 +19,6 @@ import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import okhttp3.HttpUrl;
|
||||
@ -846,17 +845,16 @@ public final class HttpLoggingInterceptorTest {
|
||||
private int index;
|
||||
|
||||
LogRecorder assertLogEqual(String expected) {
|
||||
assertThat(index < logs.size()).overridingErrorMessage("No more messages found").isTrue();
|
||||
assertThat(index).overridingErrorMessage("No more messages found").isLessThan(logs.size());
|
||||
String actual = logs.get(index++);
|
||||
assertThat(actual).isEqualTo(expected);
|
||||
return this;
|
||||
}
|
||||
|
||||
LogRecorder assertLogMatch(String pattern) {
|
||||
assertThat(index < logs.size()).overridingErrorMessage("No more messages found").isTrue();
|
||||
assertThat(index).overridingErrorMessage("No more messages found").isLessThan(logs.size());
|
||||
String actual = logs.get(index++);
|
||||
assertThat(Pattern.matches(pattern, actual)).overridingErrorMessage(
|
||||
"<" + actual + "> did not match pattern <" + pattern + ">").isTrue();
|
||||
assertThat(actual).matches(pattern);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user