This commit is contained in:
agapple
2020-02-28 13:15:27 +08:00
parent 18418ebd98
commit 5e761e14fa
47 changed files with 1378 additions and 1290 deletions

View File

@@ -1,59 +1,58 @@
package com.alibaba.otter.canal.parse.driver.mysql.packets.client;
import com.alibaba.otter.canal.parse.driver.mysql.packets.client.RegisterSlaveCommandPacket;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.Timeout;
import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
public class RegisterSlaveCommandPacketTest {
@Rule public final ExpectedException thrown = ExpectedException.none();
@Rule
public final ExpectedException thrown = ExpectedException.none();
@Rule public final Timeout globalTimeout = new Timeout(10000);
@SuppressWarnings("deprecation")
@Rule
public final Timeout globalTimeout = new Timeout(10000);
/* testedClasses: RegisterSlaveCommandPacket */
// Test written by Diffblue Cover.
@Test
public void toBytesOutput27() throws IOException, InvocationTargetException {
/* testedClasses: RegisterSlaveCommandPacket */
// Test written by Diffblue Cover.
@Test
public void toBytesOutput27() throws IOException, InvocationTargetException {
// Arrange
final RegisterSlaveCommandPacket objectUnderTest = new RegisterSlaveCommandPacket();
objectUnderTest.serverId = 0L;
objectUnderTest.reportPort = 0;
objectUnderTest.reportPasswd = "foo";
objectUnderTest.reportHost = "foo";
objectUnderTest.reportUser = "foo";
objectUnderTest.setCommand((byte)0);
// Arrange
final RegisterSlaveCommandPacket objectUnderTest = new RegisterSlaveCommandPacket();
objectUnderTest.serverId = 0L;
objectUnderTest.reportPort = 0;
objectUnderTest.reportPasswd = "foo";
objectUnderTest.reportHost = "foo";
objectUnderTest.reportUser = "foo";
objectUnderTest.setCommand((byte) 0);
// Act
final byte[] actual = objectUnderTest.toBytes();
// Act
final byte[] actual = objectUnderTest.toBytes();
// Assert result
Assert.assertArrayEquals(
new byte[] {(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)3, (byte)102,
(byte)111, (byte)111, (byte)3, (byte)102, (byte)111, (byte)111, (byte)3,
(byte)102, (byte)111, (byte)111, (byte)0, (byte)0, (byte)0, (byte)0,
(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0},
actual);
}
// Assert result
Assert.assertArrayEquals(new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 3, (byte) 102,
(byte) 111, (byte) 111, (byte) 3, (byte) 102, (byte) 111, (byte) 111, (byte) 3, (byte) 102, (byte) 111,
(byte) 111, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0,
(byte) 0 }, actual);
}
// Test written by Diffblue Cover.
@Test
public void toLHInputZeroOutput4() {
// Test written by Diffblue Cover.
@Test
public void toLHInputZeroOutput4() {
// Arrange
final int n = 0;
// Arrange
final int n = 0;
// Act
final byte[] actual = RegisterSlaveCommandPacket.toLH(n);
// Act
final byte[] actual = RegisterSlaveCommandPacket.toLH(n);
// Assert result
Assert.assertArrayEquals(new byte[] {(byte)0, (byte)0, (byte)0, (byte)0}, actual);
}
// Assert result
Assert.assertArrayEquals(new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 0 }, actual);
}
}