Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. import static org.junit.Assert.*;
  2. import org.junit.Test;
  3. import org.apache.commons.lang.StringUtils;
  4.  
  5. /**
  6.  *
  7.  */
  8.  
  9. /**
  10.  * @author einolfs
  11.  *
  12.  */
  13. public class TestDifference {
  14.    
  15.     // Tests the difference method of StringUtils. //
  16.     // Create three strings, add two together and test the difference //
  17.     // between concatenated string and the third (differnce(a,a+b) //
  18.     // should equal b //
  19.     @Test
  20.     public void testDifferceComparison() {
  21.         String a = "The quick brown fox jumps over the lazy dog";
  22.         String b = "The Cow Jumped Over the Moon";
  23.         String c = a+b;
  24.         assertEquals(StringUtils.difference(a,a+b),b);
  25.     }
  26.    
  27.     // Tests that the difference between string a and null is //
  28.     // equal to the string a //
  29.     public void testDifferenceNull() {
  30.         String a = "The quick brown fox jumps over the lazy dog";
  31.         assertEquals(StringUtils.difference(a,null),a);
  32.     }  
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement