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

10 years ago
  1. package ksiazka.kucharska;
  2. import static org.junit.Assert.*;
  3. import javax.swing.DefaultListModel;
  4. import javax.swing.JList;
  5. import ksiazka.kucharska.CB_View;
  6. import org.junit.Test;
  7. public class DelRecipeTestTest {
  8. @Test
  9. public void testDel() {
  10. CB_View theView = new CB_View();
  11. JList recipesList = theView.getRecipesList();
  12. DefaultListModel model = (DefaultListModel) recipesList.getModel();
  13. model.addElement("recipe1");
  14. int last = model.getSize()-1;
  15. model.addElement("recipe2");
  16. model.remove(last);
  17. String item = model.get(last).toString();
  18. assertEquals("recipe2", item);
  19. }
  20. }