* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.netconf.nettyutil;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
-import com.google.common.base.Optional;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler;
import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.util.concurrent.GenericFutureListener;
import java.util.Collections;
+import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
doReturn(eventLoop).when(channel).eventLoop();
doAnswer(invocation -> {
- invocation.getArgumentAt(0, Runnable.class).run();
+ invocation.<Runnable>getArgument(0).run();
return null;
}).when(eventLoop).execute(any(Runnable.class));
- clientHello = NetconfHelloMessage.createClientHello(Collections.emptySet(), Optional.absent());
+ clientHello = NetconfHelloMessage.createClientHello(Collections.emptySet(), Optional.empty());
}
@Test
public void testSendMessage() throws Exception {
final TestingNetconfSession testingNetconfSession = new TestingNetconfSession(listener, channel, 1L);
final NetconfHelloMessage hello = NetconfHelloMessage.createClientHello(Collections.emptySet(),
- Optional.absent());
+ Optional.empty());
testingNetconfSession.sendMessage(hello);
verify(channel).writeAndFlush(hello, writeFuture);
}