Skip to content

Commit

Permalink
Refactoring a test, no logical changes
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Mar 4, 2018
1 parent ff621a2 commit 62aa722
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions java/client/test/org/openqa/selenium/remote/RemoteLogsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
package org.openqa.selenium.remote;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

import org.hamcrest.CoreMatchers;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -36,6 +37,7 @@
import org.openqa.selenium.logging.LogEntries;
import org.openqa.selenium.logging.LogEntry;
import org.openqa.selenium.logging.LogType;
import org.openqa.selenium.testing.TestUtilities;

import java.util.ArrayList;
import java.util.HashSet;
Expand Down Expand Up @@ -131,15 +133,13 @@ public void throwsOnBogusRemoteLogsResponse() {
when(
executeMethod
.execute(DriverCommand.GET_LOG, ImmutableMap.of(RemoteLogs.TYPE_KEY, LogType.BROWSER)))
.thenReturn(new ImmutableMap.Builder()
.thenReturn(new ImmutableMap.Builder<>()
.put("error", "unknown method")
.put("message", "Command not found: POST /session/11037/log")
.put("stacktrace", "").build());
try {
remoteLogs.get(LogType.BROWSER);
fail("Should have thrown WebDriverException");
} catch (WebDriverException expected) {
}

Throwable ex = TestUtilities.catchThrowable(() -> remoteLogs.get(LogType.BROWSER));
assertThat(ex, CoreMatchers.instanceOf(WebDriverException.class));

verifyNoMoreInteractions(localLogs);
}
Expand Down

0 comments on commit 62aa722

Please sign in to comment.