Skip to content

Commit

Permalink
test: update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
tt committed Oct 7, 2019
1 parent ea8ddd2 commit 3eb18e2
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class ServiceResetCommandTest {

@Test
public void test_serialize() throws Exception {
public void serialize_Serialize_SerialNumberIsaa() throws Exception {
ServiceResetCommand command = new ServiceResetCommand("aa");
Command.Builder builder = command.serialize();

Expand All @@ -39,10 +39,9 @@ public void test_serialize() throws Exception {
}

@Test
public void test_deserialize() throws Exception {
public void deserialize_NullPointerException_CommandKeyIsNotSerialNumber() throws Exception {
ServiceResetCommand command = new ServiceResetCommand("aa");


Command command1 = Command.newBuilder()
.addArgs(KeyStringValuePair.newBuilder().setKey("aa").setValue("aa").build())
.build();
Expand All @@ -53,15 +52,22 @@ public void test_deserialize() throws Exception {
exception = true;
}
Assert.assertEquals(true, exception);
}

@Test
public void deserialize_SerialNumberCompare_CommandKeyIsSerialNumberValueIsaa() throws Exception {
ServiceResetCommand command = new ServiceResetCommand("aa");

Command command2 = Command.newBuilder()
.addArgs(KeyStringValuePair.newBuilder().setKey("SerialNumber").setValue("aa").build())
.build();
ServiceResetCommand deserialize2 = command.deserialize(command2);
Assert.assertEquals("aa", deserialize2.getSerialNumber());
}


@Test
public void deserialize_SerializeAndDeserialize_SerialNumberValueIsaa() throws Exception {
ServiceResetCommand command = new ServiceResetCommand("aa");
Command.Builder builder = command.serialize();
Command command3 = builder.build();
ServiceResetCommand deserialize3 = command.deserialize(command3);
Expand Down

0 comments on commit 3eb18e2

Please sign in to comment.