Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import static org.junit.Assert.*;
- import org.junit.Test;
- import org.apache.commons.lang.StringUtils;
- /**
- *
- */
- /**
- * @author einolfs
- *
- */
- public class TestDifference {
- // Tests the difference method of StringUtils. //
- // Create three strings, add two together and test the difference //
- // between concatenated string and the third (differnce(a,a+b) //
- // should equal b //
- @Test
- public void testDifferceComparison() {
- String a = "The quick brown fox jumps over the lazy dog";
- String b = "The Cow Jumped Over the Moon";
- String c = a+b;
- assertEquals(StringUtils.difference(a,a+b),b);
- }
- // Tests that the difference between string a and null is //
- // equal to the string a //
- public void testDifferenceNull() {
- String a = "The quick brown fox jumps over the lazy dog";
- assertEquals(StringUtils.difference(a,null),a);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement