lots of exercises in java... from https://github.com/exercism/java

AcronymTest.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import org.junit.Test;
  2. import org.junit.Ignore;
  3. import static org.junit.Assert.assertEquals;
  4. /*
  5. * version: 1.1.0
  6. */
  7. public class AcronymTest {
  8. @Test
  9. public void fromTitleCasedPhrases() {
  10. final String phrase = "Portable Network Graphics";
  11. final String expected = "PNG";
  12. assertEquals(expected, new Acronym(phrase).get());
  13. }
  14. @Ignore("Remove to run test")
  15. @Test
  16. public void fromOtherTitleCasedPhrases() {
  17. final String phrase = "Ruby on Rails";
  18. final String expected = "ROR";
  19. assertEquals(expected, new Acronym(phrase).get());
  20. }
  21. @Ignore("Remove to run test")
  22. @Test
  23. public void fromPhrasesWithPunctuation() {
  24. final String phrase = "First In, First Out";
  25. final String expected = "FIFO";
  26. assertEquals(expected, new Acronym(phrase).get());
  27. }
  28. @Ignore("Remove to run test")
  29. @Test
  30. public void fromOtherPhrasesWithPunctuation() {
  31. final String phrase = "PHP: Hypertext Preprocessor";
  32. final String expected = "PHP";
  33. assertEquals(expected, new Acronym(phrase).get());
  34. }
  35. @Ignore("Remove to run test")
  36. @Test
  37. public void fromPhrasesWithNonAcronymAllCapsWord() {
  38. final String phrase = "GNU Image Manipulation Program";
  39. final String expected = "GIMP";
  40. assertEquals(expected, new Acronym(phrase).get());
  41. }
  42. @Ignore("Remove to run test")
  43. @Test
  44. public void fromPhrasesWithPunctuationAndSentenceCasing() {
  45. final String phrase = "Complementary metal-oxide semiconductor";
  46. final String expected = "CMOS";
  47. assertEquals(expected, new Acronym(phrase).get());
  48. }
  49. }