/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package tekstid; import java.util.Arrays; import java.util.Comparator; import org.junit.Test; import static org.junit.Assert.*; import org.junit.Before; /** * * @author Opetaja */ public class Tekstitest1 { Comparator pv; public Tekstitest1() { } // TODO add test methods here. // The methods must be annotated with annotation @Test. For example: @Before public void tyhiVordleja(){ pv=new PikkusteVordleja(); } @Test public void yhepikkused(){ assertEquals(0, pv.compare("Mati", "Kala")); } @Test public void esimeneLyhem(){ assertTrue(pv.compare("Kai", "Karin")<0); } //Looge test esimenePikem @Test public void esimenePikem(){ assertTrue(pv.compare("Martin", "Mati")>0); } @Test public void loeteluSort(){ String[] m=new String[]{"Anton", "Ain", "Mai", "Mari"}; Arrays.sort(m, pv); assertArrayEquals( new String[]{"Ain", "Mai", "Mari", "Anton"}, m ); } @Test public void loeteluSort2(){ String[] m=new String[]{"Anton", "Mai","Ain", "Mari"}; Arrays.sort(m, pv); assertArrayEquals( new String[]{"Mai", "Ain", "Mari", "Anton"}, m ); } }