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

AcronymTest.java 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import org.junit.Test;
  2. import org.junit.Ignore;
  3. import static org.junit.Assert.assertEquals;
  4. public class AcronymTest {
  5. @Test
  6. public void fromTitleCasedPhrases() {
  7. final String phrase = "Portable Network Graphics";
  8. final String expected = "PNG";
  9. assertEquals(expected, new Acronym(phrase).get());
  10. }
  11. @Ignore
  12. @Test
  13. public void fromOtherTitleCasedPhrases() {
  14. final String phrase = "Ruby on Rails";
  15. final String expected = "ROR";
  16. assertEquals(expected, new Acronym(phrase).get());
  17. }
  18. @Ignore
  19. @Test
  20. public void fromInconsistentlyCasedPhrases() {
  21. final String phrase = "HyperText Markup Language";
  22. final String expected = "HTML";
  23. assertEquals(expected, new Acronym(phrase).get());
  24. }
  25. @Ignore
  26. @Test
  27. public void fromPhrasesWithPunctuation() {
  28. final String phrase = "First In, First Out";
  29. final String expected = "FIFO";
  30. assertEquals(expected, new Acronym(phrase).get());
  31. }
  32. @Ignore
  33. @Test
  34. public void fromOtherPhrasesWithPunctuation() {
  35. final String phrase = "PHP: Hypertext Preprocessor";
  36. final String expected = "PHP";
  37. assertEquals(expected, new Acronym(phrase).get());
  38. }
  39. @Ignore
  40. @Test
  41. public void fromPhrasesWithNonAcronymAllCapsWord() {
  42. final String phrase = "GNU Image Manipulation Program";
  43. final String expected = "GIMP";
  44. assertEquals(expected, new Acronym(phrase).get());
  45. }
  46. @Ignore
  47. @Test
  48. public void fromPhrasesWithPunctuationAndSentenceCasing() {
  49. final String phrase = "Complementary metal-oxide semiconductor";
  50. final String expected = "CMOS";
  51. assertEquals(expected, new Acronym(phrase).get());
  52. }
  53. @Ignore
  54. @Test
  55. public void fromPhraseWithSingleLetterWord() {
  56. final String phrase = "Cat in a Hat";
  57. final String expected = "CIAH";
  58. assertEquals(expected, new Acronym(phrase).get());
  59. }
  60. }