package test.leecode.string; import org.junit.Assert; import org.junit.Test; import cn.fansunion.leecode.string.FindSmallestLetterGreaterThanTarget; /** * @author wen.lei@brgroup.com * * 2022-2-25 */ public class FindSmallestLetterGreaterThanTargetTest { @Test public void test() { FindSmallestLetterGreaterThanTarget test = new FindSmallestLetterGreaterThanTarget(); char [] letters = { 'c' , 'f' , 'j' };; Assert.assertEquals( 'c' , test.nextGreatestLetter(letters, 'a' )); char [] letters2 = { 'c' , 'f' , 'j' };; Assert.assertEquals( 'f' , test.nextGreatestLetter(letters2, 'c' )); char [] letters3 = { 'c' , 'f' , 'j' };; Assert.assertEquals( 'f' , test.nextGreatestLetter(letters3, 'd' )); char [] letters4 = { 'c' , 'f' , 'j' };; Assert.assertEquals( 'c' , test.nextGreatestLetter(letters4, 'z' )); } } |