Cook book written in Java
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

27 lines
604 B

package ksiazka.kucharska;
import static org.junit.Assert.*;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import ksiazka.kucharska.CB_View;
import org.junit.Test;
public class DelRecipeTestTest {
@Test
public void testDel() {
CB_View theView = new CB_View();
JList recipesList = theView.getRecipesList();
DefaultListModel model = (DefaultListModel) recipesList.getModel();
model.addElement("recipe1");
int last = model.getSize()-1;
model.addElement("recipe2");
model.remove(last);
String item = model.get(last).toString();
assertEquals("recipe2", item);
}
}