Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.epam.hushchyn.part3;
- import java.io.ByteArrayInputStream;
- import java.io.IOException;
- import org.junit.Assert;
- import org.junit.Test;
- import com.epam.hushchyn.part3.Part3;
- public class Part3Test {
- @Test
- public void testPart3() throws IOException {
- String[] arg = { "char", "String", "int", "double", "alghak" };
- String[] res = { "a и л ", "bcd фвыа ", "432 89 ", "43.43 .98 ",
- "error" };
- for (int i = 0; i < arg.length; i++) {
- String actual = Part3.part3(arg[i]);
- Assert.assertEquals(res[i], actual);
- }
- }
- @Test
- public void testPart32() throws IOException {
- String[] arg = { "char", "String", "int", "double", "alghak" };
- String[] res = { "a и л ", "bcd фвыа ", "432 89 ", "43.43 .98 ",
- "error" };
- for (int i = 0; i < arg.length; i++) {
- String actual = Part3.part3(arg[i]);
- Assert.assertEquals(res[i], actual);
- }
- }
- @Test
- public void testConstructor() {
- new Part3();
- }
- @Test
- public void testMain() throws IOException {
- String arg[] = { "" };
- System.setIn(new ByteArrayInputStream(
- "char\nString\nint\ndouble\nalghak\nstop".getBytes("UTF-8")));
- Part3.main(arg);
- }
- /*
- * @Test (expected = NullPointerException.class) public void testMain2()
- * throws IOException { String arg[] = { "" }; System.setIn(new
- * ByteArrayInputStream(null)); Part3.main(arg); }
- */
- }
Add Comment
Please, Sign In to add comment