public void assertIsSorted ( Description description , char [ ] actual ) { if ( actual == null ) { throw failures . failure ( "The actual is null" ) ; } if ( actual . length == 0 ) { return ; } for ( int i = 0 ; i < actual . length - 1 ; i ++ ) { if ( actual [ i ] > actual [ i + 1 ] ) { throw failures . failure ( description , shouldBeSorted ( i , actual ) ) ; } } }
Verifies that the actual is sorted into ascending order according to the natural ordering of its elements . Empty arrays are considered sorted .