예제 #1
0
 @Test
 public void testIntegerValue() {
   int counter = 0;
   String[] arr = part3.integerValue().split(" ");
   Pattern p = Pattern.compile(REGEXP_FOR_INTEGER);
   Matcher m = p.matcher(part3.getString());
   while (m.find()) {
     ++counter;
   }
   Assert.assertEquals(counter, arr.length);
 }
예제 #2
0
  @Test
  public void TestInput() {
    try {
      System.setIn(new ByteArrayInputStream("char\nString\nint\ndouble\nstop".getBytes(ENCODING)));
    } catch (UnsupportedEncodingException e) {
      System.out.println("Wrong encoding in Part3Test");
    }

    part3.input();
    try {
      System.setIn(
          new ByteArrayInputStream("char\nString\nint\ndouble\nfdsfds".getBytes(ENCODING)));
    } catch (UnsupportedEncodingException e) {
      System.out.println("Wrong encoding in Part3Test");
    }
    part3.input();
    System.setIn(System.in);
  }
예제 #3
0
 @Test
 public void testTestString() {
   part3.getString();
   part3.setFileName("INCORRECT_FILENAME");
   part3.getString();
 }