Guest User

Untitled

a guest
Mar 30th, 2016
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.58 KB | None | 0 0
  1. package com.epam.hushchyn.part3;
  2.  
  3. import java.io.ByteArrayInputStream;
  4. import java.io.IOException;
  5.  
  6. import org.junit.Assert;
  7. import org.junit.Test;
  8.  
  9. import com.epam.hushchyn.part3.Part3;
  10.  
  11. public class Part3Test {
  12.  
  13.     @Test
  14.     public void testPart3() throws IOException {
  15.         String[] arg = { "char", "String", "int", "double", "alghak" };
  16.         String[] res = { "a и л ", "bcd фвыа ", "432 89 ", "43.43 .98 ",
  17.                 "error" };
  18.  
  19.         for (int i = 0; i < arg.length; i++) {
  20.  
  21.             String actual = Part3.part3(arg[i]);
  22.             Assert.assertEquals(res[i], actual);
  23.         }
  24.     }
  25.  
  26.     @Test
  27.     public void testPart32() throws IOException {
  28.         String[] arg = { "char", "String", "int", "double", "alghak" };
  29.         String[] res = { "a и л ", "bcd фвыа ", "432 89 ", "43.43 .98 ",
  30.                 "error" };
  31.  
  32.         for (int i = 0; i < arg.length; i++) {
  33.  
  34.             String actual = Part3.part3(arg[i]);
  35.             Assert.assertEquals(res[i], actual);
  36.         }
  37.     }
  38.  
  39.     @Test
  40.     public void testConstructor() {
  41.        new Part3();
  42.     }
  43.  
  44.     @Test
  45.     public void testMain() throws IOException {
  46.         String arg[] = { "" };
  47.         System.setIn(new ByteArrayInputStream(
  48.                 "char\nString\nint\ndouble\nalghak\nstop".getBytes("UTF-8")));
  49.         Part3.main(arg);
  50.     }
  51.  
  52.     /*
  53.      * @Test (expected = NullPointerException.class) public void testMain2()
  54.      * throws IOException { String arg[] = { "" }; System.setIn(new
  55.      * ByteArrayInputStream(null)); Part3.main(arg); }
  56.      */
  57.  
  58. }
Add Comment
Please, Sign In to add comment