|  | 
| 17 | 17 | 
 | 
| 18 | 18 | package org.openqa.selenium.remote; | 
| 19 | 19 | 
 | 
|  | 20 | +import static org.mockito.ArgumentMatchers.anyString; | 
| 20 | 21 | import static org.mockito.Mockito.times; | 
| 21 | 22 | import static org.mockito.Mockito.verify; | 
| 22 | 23 | import static org.mockito.Mockito.verifyNoMoreInteractions; | 
| @@ -48,7 +49,7 @@ class TracedCommandExecutorTest { | 
| 48 | 49 |   public void createMocksAndTracedCommandExecutor() { | 
| 49 | 50 |     MockitoAnnotations.initMocks(this); | 
| 50 | 51 |     when(tracer.getCurrentContext()).thenReturn(traceContext); | 
| 51 |  | -    when(traceContext.createSpan("command")).thenReturn(span); | 
|  | 52 | +    when(traceContext.createSpan(anyString())).thenReturn(span); | 
| 52 | 53 |     tracedCommandExecutor = new TracedCommandExecutor(commandExecutor, tracer); | 
| 53 | 54 |   } | 
| 54 | 55 | 
 | 
| @@ -109,4 +110,18 @@ void canCreateSpanWithCommandName() throws IOException { | 
| 109 | 110 |     verify(span, times(1)).close(); | 
| 110 | 111 |     verifyNoMoreInteractions(span); | 
| 111 | 112 |   } | 
|  | 113 | + | 
|  | 114 | +  @Test | 
|  | 115 | +  void canCreateSpanWithCommandNameAsSpanName() throws IOException { | 
|  | 116 | +    SessionId sessionId = new SessionId(UUID.randomUUID()); | 
|  | 117 | +    Command command = new Command(sessionId, "findElement"); | 
|  | 118 | + | 
|  | 119 | +    tracedCommandExecutor.execute(command); | 
|  | 120 | + | 
|  | 121 | +    verify(traceContext).createSpan("findElement"); | 
|  | 122 | +    verify(span).setAttribute("sessionId", sessionId.toString()); | 
|  | 123 | +    verify(span).setAttribute("command", "findElement"); | 
|  | 124 | +    verify(span).close(); | 
|  | 125 | +    verifyNoMoreInteractions(span); | 
|  | 126 | +  } | 
| 112 | 127 | } | 
0 commit comments