PacketLineInTest: test for END and DELIM being distinguishable
Explicitly test that END and DELIM can be distinguished. If not, the wire protocol V2 breaks down. Bug: 568950 Change-Id: I5f3496168244303c68893f1c756831dd27440aeb Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
This commit is contained in:
parent
4f30dc5eb9
commit
c053b510b3
|
@ -12,8 +12,8 @@
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -111,20 +111,25 @@ public void testReadString_Len0004() throws IOException {
|
|||
final String act = in.readString();
|
||||
assertEquals("", act);
|
||||
assertFalse(PacketLineIn.isEnd(act));
|
||||
assertFalse(PacketLineIn.isDelimiter(act));
|
||||
assertEOF();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadString_End() throws IOException {
|
||||
init("0000");
|
||||
assertTrue(PacketLineIn.isEnd(in.readString()));
|
||||
String act = in.readString();
|
||||
assertTrue(PacketLineIn.isEnd(act));
|
||||
assertFalse(PacketLineIn.isDelimiter(act));
|
||||
assertEOF();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadString_Delim() throws IOException {
|
||||
init("0001");
|
||||
assertTrue(PacketLineIn.isDelimiter(in.readString()));
|
||||
String act = in.readString();
|
||||
assertTrue(PacketLineIn.isDelimiter(act));
|
||||
assertFalse(PacketLineIn.isEnd(act));
|
||||
assertEOF();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue