@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); }
@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); }
@Test public void testTestString() { part3.getString(); part3.setFileName("INCORRECT_FILENAME"); part3.getString(); }