Examples of ToDoItem


Examples of com.davidsalter.apps.todo.model.ToDoItem

     */
    @Before
    public void prepareTest() throws Exception {
        utx.begin();
        for (String title : ITEM_DESCRIPTIONS) {
            ToDoItem item = new ToDoItem(title);
            em.persist(item);
        }
        utx.commit();
    }
View Full Code Here

Examples of com.davidsalter.apps.todo.model.ToDoItem

    /**
     * Test the ToDoItemController.addItem() method.
     */
    @Test
    public void testAddItem() {
        ToDoItem item = new ToDoItem("A test item");
        toDoItemController.addItem(item);
        List<ToDoItem> items = toDoItemController.getItems();
        Assert.assertEquals("Invalid number of items returned after adding an item", ITEM_DESCRIPTIONS.length + 1, items.size());
    }
View Full Code Here

Examples of com.davidsalter.apps.todo.model.ToDoItem

    /**
     * Test the ToDoItemController.editItem() method.
     */
    @Test
    public void testEditItem() {
        ToDoItem item = new ToDoItem("A test item");
        toDoItemController.addItem(item);
        Integer id = item.getId();

        String newDescription = "A new description";
        item.setDescription(newDescription);
        toDoItemController.editItem(item);
        Assert.assertEquals("Invalid edit of item", newDescription, item.getDescription());

        ToDoItem copyItem = toDoItemController.getItem(id);
        Assert.assertEquals("Invalid edit of item", newDescription, copyItem.getDescription());
    }
View Full Code Here

Examples of com.manning.gia.todo.model.ToDoItem

        h2ToDoRepository = new H2ToDoRepository();
    }

    @Test
    public void testInsertToDoItem() {
        ToDoItem newToDoItem = new ToDoItem();
        newToDoItem.setName("Write integration tests");
        Long newId = h2ToDoRepository.insert(newToDoItem);
        newToDoItem.setId(newId);
        assertNotNull(newId);

        ToDoItem persistedToDoItem = h2ToDoRepository.findById(newId);
        assertNotNull(persistedToDoItem);
        assertEquals(newToDoItem, persistedToDoItem);
    }
View Full Code Here

Examples of com.todo.client.ToDoItem

    // if white-space only, do not add a todo
    if (taskTitle.equals(""))
      return;

    ToDoItem toDoItem = new ToDoItem(taskTitle);
    view.clearTaskText();
    todos.add(toDoItem);

    taskStateChanged();
  }
View Full Code Here

Examples of dom.todo.ToDoItem

                // sent to both the general on(ActionInteractionEvent ev)
                // and also the specific on(final ToDoItem.CompletedEvent ev)
                assertThat(receivedEvents.size(), is(5*2));
                final ToDoItem.CompletedEvent ev = receivedEvents.get(0);

                ToDoItem source = ev.getSource();
                assertThat(source, is(equalTo(unwrap(toDoItem))));
                assertThat(ev.getIdentifier().getMemberName(), is("completed"));
            }
View Full Code Here

Examples of dom.todo.ToDoItem

                // and then
                final ActionInteractionEvent<ToDoItem> ev = toDoItemSubscriptions.mostRecentlyReceivedEvent(ActionInteractionEvent.class);
                assertThat(ev, is(not(nullValue())));

                ToDoItem source = ev.getSource();
                assertThat(source, is(equalTo(unwrap(toDoItem))));
                assertThat(ev.getIdentifier().getMemberName(), is("notYetCompleted"));
            }
View Full Code Here

Examples of dom.todo.ToDoItem

                // then published and received
                @SuppressWarnings("unchecked")
                final PropertyInteractionEvent<ToDoItem,String> ev = toDoItemSubscriptions.mostRecentlyReceivedEvent(PropertyInteractionEvent.class);
                assertThat(ev, is(not(nullValue())));

                ToDoItem source = ev.getSource();
                assertThat(source, is(equalTo(unwrap(toDoItem))));
                assertThat(ev.getIdentifier().getMemberName(), is("description"));
                assertThat(ev.getOldValue(), is("Buy bread"));
                assertThat(ev.getNewValue(), is("Buy bread and butter"));
            }
View Full Code Here

Examples of dom.todo.ToDoItem

        @Test
        public void complete_and_notYetComplete() throws Exception {

            // given
            List<ToDoItem> notYetCompleteItems = wrap(toDoItems).notYetComplete();
            final ToDoItem toDoItem = wrap(notYetCompleteItems.get(0));
            nextTransaction();

            // when
            toDoItem.completed();
            nextTransaction();

            // then
            assertThat(wrap(toDoItems).notYetComplete().size(), is(notYetCompletedSize-1));
            assertThat(wrap(toDoItems).complete().size(), is(completedSize+1));
            nextTransaction();

            // and when
            toDoItem.notYetCompleted();
            nextTransaction();

            // then
            assertThat(wrap(toDoItems).notYetComplete().size(), is(notYetCompletedSize));
            assertThat(wrap(toDoItems).complete().size(), is(completedSize));
View Full Code Here

Examples of dom.todo.ToDoItem

            // given
            int size = wrap(toDoItems).notYetComplete().size();
            nextTransaction();

            // when
            final ToDoItem newToDo = toDoItems.newToDo("new todo", ToDoItem.Category.Professional, ToDoItem.Subcategory.OpenSource, null, null);
            nextTransaction();

            // then
            assertThat(newToDo.getDescription(), is("new todo"));
            assertThat(newToDo.getCategory(), is(ToDoItem.Category.Professional));
            assertThat(wrap(toDoItems).notYetComplete().size(), is(size+1));
            assertThat(container().isPersistent(newToDo), is(true));
            assertThat(container().isPersistent(wrap(newToDo)), is(true));

            nextTransaction();

            // when
            newToDo.delete();
            nextTransaction();

            // then
            assertThat(wrap(toDoItems).notYetComplete().size(), is(size));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.