MySQLClient { public synchronized int executeUpdate(final String queryString) { responseCallback = new DefaultPromise<>(eventLoopGroup.next()); MySQLComQueryPacket comQueryPacket = new MySQLComQueryPacket(queryString); channel.writeAndFlush(comQueryPacket); return (int) waitExpectedResponse(MySQLOKPacket.class).getAffectedRows(); }  synchronized void connect(); synchronized boolean execute(final String queryString); synchronized int executeUpdate(final String queryString); synchronized InternalResultSet executeQuery(final String queryString); synchronized void subscribe(final String binlogFileName, final long binlogPosition); synchronized AbstractBinlogEvent poll();  }
@Test public void assertExecuteUpdate() throws NoSuchFieldException, IllegalAccessException { MySQLOKPacket expected = new MySQLOKPacket(0, 10, 0); ReflectionUtil.setFieldValueToClass(expected, "affectedRows", 10); mockChannelResponse(expected); ReflectionUtil.setFieldValueToClass(mysqlClient, "channel", channel); ReflectionUtil.setFieldValueToClass(mysqlClient, "eventLoopGroup", new NioEventLoopGroup(1)); assertThat(mysqlClient.executeUpdate(""), is(10)); verify(channel).writeAndFlush(ArgumentMatchers.any(MySQLComQueryPacket.class)); }