Examples of Todo


Examples of net.petrikainulainen.spring.testmvc.todo.model.Todo

        ArgumentCaptor<Todo> toDoArgument = ArgumentCaptor.forClass(Todo.class);
        verify(repositoryMock, times(1)).save(toDoArgument.capture());
        verifyNoMoreInteractions(repositoryMock);

        Todo model = toDoArgument.getValue();

        assertNull(model.getId());
        assertEquals(dto.getDescription(), model.getDescription());
        assertEquals(dto.getTitle(), model.getTitle());
    }
View Full Code Here

Examples of net.petrikainulainen.spring.testmvc.todo.model.Todo

        assertEquals(dto.getTitle(), model.getTitle());
    }

    @Test
    public void deleteById() throws TodoNotFoundException {
        Todo model = TodoTestUtil.createModel(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION, TodoTestUtil.TITLE);
        when(repositoryMock.findOne(TodoTestUtil.ID)).thenReturn(model);

        Todo actual = service.deleteById(TodoTestUtil.ID);

        verify(repositoryMock, times(1)).findOne(TodoTestUtil.ID);
        verify(repositoryMock, times(1)).delete(model);
        verifyNoMoreInteractions(repositoryMock);
View Full Code Here

Examples of net.petrikainulainen.spring.testmvc.todo.model.Todo

        assertEquals(models, actual);
    }

    @Test
    public void findById() throws TodoNotFoundException {
        Todo model = TodoTestUtil.createModel(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION, TodoTestUtil.TITLE);
        when(repositoryMock.findOne(TodoTestUtil.ID)).thenReturn(model);

        Todo actual = service.findById(TodoTestUtil.ID);

        verify(repositoryMock, times(1)).findOne(TodoTestUtil.ID);
        verifyNoMoreInteractions(repositoryMock);

        assertEquals(model, actual);
View Full Code Here

Examples of net.petrikainulainen.spring.testmvc.todo.model.Todo

    }

    @Test
    public void update() throws TodoNotFoundException {
        TodoDTO dto = TodoTestUtil.createDTO(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION_UPDATED, TodoTestUtil.TITLE_UPDATED);
        Todo model = TodoTestUtil.createModel(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION, TodoTestUtil.TITLE);
        when(repositoryMock.findOne(dto.getId())).thenReturn(model);

        Todo actual = service.update(dto);

        verify(repositoryMock, times(1)).findOne(dto.getId());
        verifyNoMoreInteractions(repositoryMock);

        assertEquals(dto.getId(), actual.getId());
        assertEquals(dto.getDescription(), actual.getDescription());
        assertEquals(dto.getTitle(), actual.getTitle());
    }
View Full Code Here

Examples of net.petrikainulainen.spring.testmvc.todo.model.Todo

    }

    @Test
    public void add() throws FormValidationError {
        TodoDTO dto = TodoTestUtil.createDTO(null, TodoTestUtil.DESCRIPTION, TodoTestUtil.TITLE);
        Todo expected = TodoTestUtil.createModel(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION, TodoTestUtil.TITLE);
        when(serviceMock.add(dto)).thenReturn(expected);

        TodoDTO actual = controller.add(dto);

        verify(serviceMock, times(1)).add(dto);
View Full Code Here

Examples of net.petrikainulainen.spring.testmvc.todo.model.Todo

        verifyZeroInteractions(localeHolderWrapperMock, messageSourceMock, serviceMock);
    }

    @Test
    public void deleteById() throws TodoNotFoundException {
        Todo expected = TodoTestUtil.createModel(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION, TodoTestUtil.TITLE);
        when(serviceMock.deleteById(TodoTestUtil.ID)).thenReturn(expected);

        TodoDTO actual = controller.deleteById(TodoTestUtil.ID);

        verify(serviceMock, times(1)).deleteById(TodoTestUtil.ID);
View Full Code Here

Examples of net.petrikainulainen.spring.testmvc.todo.model.Todo

        verifyZeroInteractions(localeHolderWrapperMock, messageSourceMock);
    }

    @Test
    public void findAll() {
        Todo model = TodoTestUtil.createModel(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION, TodoTestUtil.TITLE);
        List<Todo> expected = createModels(model);

        when(serviceMock.findAll()).thenReturn(expected);

        List<TodoDTO> actual = controller.findAll();
View Full Code Here

Examples of net.petrikainulainen.spring.testmvc.todo.model.Todo

    }

    @Test
    public void update() throws FormValidationError, TodoNotFoundException {
        TodoDTO dto = TodoTestUtil.createDTO(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION_UPDATED, TodoTestUtil.TITLE_UPDATED);
        Todo expected = TodoTestUtil.createModel(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION, TodoTestUtil.TITLE);
        when(serviceMock.update(dto)).thenReturn(expected);

        TodoDTO actual = controller.update(dto, TodoTestUtil.ID);

        verify(serviceMock, times(1)).update(dto);
View Full Code Here

Examples of net.petrikainulainen.spring.testmvc.todo.model.Todo

    private void assertTodos(List<Todo> expected, List<TodoDTO> actual) {
        assertEquals(expected.size(), actual.size());

        for (int index = 0; index < expected.size(); index++) {
            Todo model = expected.get(index);
            TodoDTO dto = actual.get(index);
            assertTodo(model, dto);
        }
    }
View Full Code Here

Examples of net.petrikainulainen.spring.testmvc.todo.model.Todo

        return todos;
    }

    @Test
    public void findById() throws TodoNotFoundException {
        Todo expected = TodoTestUtil.createModel(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION, TodoTestUtil.TITLE);
        when(serviceMock.findById(TodoTestUtil.ID)).thenReturn(expected);

        TodoDTO actual = controller.findById(TodoTestUtil.ID);

        verify(serviceMock, times(1)).findById(TodoTestUtil.ID);
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.