Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.59 KB | None | 0 0
  1. package com.punicapp.sample;
  2.  
  3. import com.punicapp.core.utils.StringUtils;
  4.  
  5. import org.junit.Test;
  6. import org.junit.runner.RunWith;
  7. import org.junit.runners.Parameterized;
  8.  
  9. import java.util.Arrays;
  10. import java.util.Collection;
  11.  
  12. import static org.junit.Assert.*;
  13.  
  14. /**
  15.  * Created by Evgeny on 17.01.18.
  16.  */
  17. @RunWith(Parameterized.class)
  18. public class StringUtilsTest {
  19.  
  20.     @Parameterized.Parameter(value = 0)
  21.     public String inputTestData;
  22.  
  23.     @Parameterized.Parameter(value = 1)
  24.     public String outputTestData;
  25.  
  26.     @Parameterized.Parameters
  27.     public static Collection<Object[]> initParameters() {
  28.         return Arrays.asList(new Object[][] {
  29.                 {"wbcschqv", "Wbcschqv" },
  30.                 { "Ac nbvh", "Ac nbvh" },
  31.                 { "_vnnqsn", "_vnnqsn" },
  32.                 {".Fbbhqkxn sscb", ".Fbbhqkxn sscb"},
  33.                 {"@ndbasb", "@ndbasb"},
  34.                 {"1abc", "1abc"},
  35.                 {null, ""},
  36.                 {"", ""},
  37.                 {"ädnsjnc", "Ädnsjnc"},
  38.                 {"万111", "万111"}});
  39.     }
  40.  
  41.     @Test
  42.     public void testCapitalizeCorrectness() {
  43.         assertEquals(outputTestData, StringUtils.capitalize(inputTestData));
  44.     }
  45.  
  46.     @Test
  47.     public void testCapitalizeExceptionHandling() {
  48.         try {
  49.             StringUtils.capitalize(inputTestData);
  50.         } catch (Exception exception) {
  51.             fail("Exception not handling! " + exception.getMessage());
  52.         }
  53.     }
  54.  
  55.     @Test(timeout = 1)
  56.     public void testCapitalizeSingleRuntime() {
  57.         StringUtils.capitalize(inputTestData);
  58.     }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement