Пример #1
0
 @Test
 public void testRunTaskMyInput() {
   int expected = 16;
   obj.setNumber(15);
   obj.runEx();
   int actual = obj.getResult();
   Assert.assertEquals(expected, actual);
   System.setIn(System.in);
 }
Пример #2
0
 @Test
 public void testRunTaskDefaultInit() {
   int expected = 2;
   ByteArrayInputStream in = new ByteArrayInputStream("-1".getBytes());
   System.setIn(in);
   obj.runEx();
   int actual = obj.getResult();
   Assert.assertEquals(expected, actual);
   System.setIn(System.in);
 }