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

AcronymTest.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 basic() {
  7. final String phrase = "Portable Network Graphics";
  8. final String expected = "PNG";
  9. assertEquals(expected, new Acronym(phrase).get());
  10. }
  11. @Ignore("Remove to run test")
  12. @Test
  13. public void lowercaseWords() {
  14. final String phrase = "Ruby on Rails";
  15. final String expected = "ROR";
  16. assertEquals(expected, new Acronym(phrase).get());
  17. }
  18. @Ignore("Remove to run test")
  19. @Test
  20. public void punctuation() {
  21. final String phrase = "First In, First Out";
  22. final String expected = "FIFO";
  23. assertEquals(expected, new Acronym(phrase).get());
  24. }
  25. @Ignore("Remove to run test")
  26. @Test
  27. public void NonAcronymAllCapsWord() {
  28. final String phrase = "GNU Image Manipulation Program";
  29. final String expected = "GIMP";
  30. assertEquals(expected, new Acronym(phrase).get());
  31. }
  32. @Ignore("Remove to run test")
  33. @Test
  34. public void punctuationWithoutWhitespace() {
  35. final String phrase = "Complementary metal-oxide semiconductor";
  36. final String expected = "CMOS";
  37. assertEquals(expected, new Acronym(phrase).get());
  38. }
  39. }