IsRotationUsingIsSubstring { public boolean check(String s1, String s2) { validateInput(s1, s2); if (haveSameLength(s1, s2)) { String s1s1 = s1 + s1; return isSubstring(s1s1, s2); } return false; }  boolean check(String s1, String s2);  }
@Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullInstancesAsFirstParameter() { isRotation.check(null, ""); }
@Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullInstancesAsSecondParameter() { isRotation.check("", null); }
@Test public void shouldReturnFalseIfS2IsNotRotationOfS1() { String s1 = "waterbottle"; String s2 = "pedro"; boolean result = isRotation.check(s1, s2); assertFalse(result); }
@Test public void shouldReturnTrueIfS2IsNotRotationOfS1() { String s1 = "waterbottle"; String s2 = "erbottlewat"; boolean result = isRotation.check(s1, s2); assertTrue(result); }