示例#1
0
 @Test
 // 从不存在的节点接收
 public void testSendInfor7() throws InterruptedException {
   // fail("Not yet implemented");
   blackbox.sendInfor("S0,0,\"hello world\",R2,");
   Thread.sleep(100);
   assertEquals("Error: Index out of bound: R2\n", outContent.toString());
 }
示例#2
0
 @Test
 // 语法错误2
 public void testSendInfor9() throws InterruptedException {
   // fail("Not yet implemented");
   blackbox.sendInfor("S0,0,\"hello world\",R0");
   Thread.sleep(100);
   assertEquals("Invalid arg: S0,0,\"hello world\",R0\n", outContent.toString());
 }
示例#3
0
 @Test
 // 孤立Sender节点
 public void testSendInfor5() throws InterruptedException {
   // fail("Not yet implemented");
   blackbox.sendInfor("S2,0,\"hello world\",R0,");
   Thread.sleep(100);
   assertEquals("", outContent.toString());
 }
示例#4
0
 @Test
 // 加密情况3
 public void testSendInfor3() throws InterruptedException {
   // fail("Not yet implemented");
   Pattern pattern = Pattern.compile("R0 received: \\(S1,R0,\"hello world\",.*\\)");
   blackbox.sendInfor("S1,1,\"hello world\",R0,");
   Thread.sleep(100);
   Matcher matcher = pattern.matcher(outContent.toString());
   assertTrue(matcher.find());
 }