1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-27 18:21:14 +03:00

Merge pull request #2038 from square/jw/getter

Log level getter.
This commit is contained in:
Jesse Wilson
2015-11-24 22:43:53 -05:00
2 changed files with 14 additions and 0 deletions

View File

@@ -130,6 +130,10 @@ public final class HttpLoggingInterceptor implements Interceptor {
return this; return this;
} }
public Level getLevel() {
return level;
}
@Override public Response intercept(Chain chain) throws IOException { @Override public Response intercept(Chain chain) throws IOException {
Level level = this.level; Level level = this.level;

View File

@@ -68,6 +68,16 @@ public final class HttpLoggingInterceptorTest {
url = server.url("/"); url = server.url("/");
} }
@Test public void levelGetter() {
// The default is NONE.
assertEquals(Level.NONE, applicationInterceptor.getLevel());
for (Level level : Level.values()) {
applicationInterceptor.setLevel(level);
assertEquals(level, applicationInterceptor.getLevel());
}
}
@Test public void setLevelShouldPreventNullValue() { @Test public void setLevelShouldPreventNullValue() {
try { try {
applicationInterceptor.setLevel(null); applicationInterceptor.setLevel(null);