Skip to content

Instantly share code, notes, and snippets.

@mrenouf
Created February 1, 2011 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrenouf/805746 to your computer and use it in GitHub Desktop.
Save mrenouf/805746 to your computer and use it in GitHub Desktop.
Test cases for Plurals.java
package com.bitgrind.text;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeNotNull;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
@RunWith(Theories.class)
public class PluralsTest {
// @formatter:off
@DataPoints
public static String[][] tests = {
{"sausage", "sausages"},
{"status", "statuses"},
{"ax", "axes"},
{"octopus", "octopi"},
{"virus", "viri"},
{"crush", "crushes"},
{"crutch", "crutches"},
{"matrix", "matrices"},
{"index", "indices"},
{"mouse", "mice"},
{"quiz", "quizzes"},
{"mailman", "mailmen"},
{"man", "men"},
{"wolf", "wolves"},
{"wife", "wives"},
{"price", "prices"},
{"slice", "slices"},
{"day", "days"},
{"sky", "skies"},
{"salesperson", "salespeople"},
};
// @formatter:on
@Theory
public void testPluralize(String[] testCase) {
assumeNotNull((Object[]) testCase);
assertThat(Plurals.pluralize(testCase[0]), is(equalTo(testCase[1])));
}
@Theory
public void testSingularize(String[] testCase) {
assumeNotNull((Object[]) testCase);
assertThat(Plurals.singularize(testCase[1]), is(equalTo(testCase[0])));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment