Package net.petrikainulainen.spring.testmvc.todo.dto

Examples of net.petrikainulainen.spring.testmvc.todo.dto.TodoDTOBuilder


        verifyZeroInteractions(todoServiceMock);
    }

    @Test
    public void update_TodoEntryNotFound_ShouldReturnHttpStatusCode404() throws Exception {
        TodoDTO dto = new TodoDTOBuilder()
                .id(3L)
                .description("description")
                .title("title")
                .build();
View Full Code Here


        assertThat(dtoArgument.getTitle(), is("title"));
    }

    @Test
    public void update_TodoEntryFound_ShouldUpdateTodoEntryAndReturnIt() throws Exception {
        TodoDTO dto = new TodoDTOBuilder()
                .id(1L)
                .description("description")
                .title("title")
                .build();
View Full Code Here

        service = new RepositoryTodoService(repositoryMock);
    }

    @Test
    public void add_NewTodoEntry_ShouldSaveTodoEntry() {
        TodoDTO dto = new TodoDTOBuilder()
                .description(DESCRIPTION)
                .title(TITLE)
                .build();

        service.add(dto);
View Full Code Here

        verifyNoMoreInteractions(repositoryMock);
    }

    @Test
    public void update_TodoEntryFound_ShouldUpdateTodoEntry() throws TodoNotFoundException {
        TodoDTO dto = new TodoDTOBuilder()
                .id(ID)
                .description(DESCRIPTION_UPDATED)
                .title(TITLE_UPDATED)
                .build();
View Full Code Here

        assertThat(model.getTitle(), is(dto.getTitle()));
    }

    @Test(expected = TodoNotFoundException.class)
    public void update_TodoEntryNotFound_ShouldThrowException() throws TodoNotFoundException {
        TodoDTO dto = new TodoDTOBuilder()
                .id(ID)
                .description(DESCRIPTION_UPDATED)
                .title(TITLE_UPDATED)
                .build();
View Full Code Here

    @Test
    public void add_TitleAndDescriptionAreTooLong_ShouldReturnValidationErrorsForTitleAndDescription() throws Exception {
        String title = TestUtil.createStringWithLength(Todo.MAX_LENGTH_TITLE + 1);
        String description = TestUtil.createStringWithLength(Todo.MAX_LENGTH_DESCRIPTION + 1);

        TodoDTO dto = new TodoDTOBuilder()
                .description(description)
                .title(title)
                .build();

        mockMvc.perform(post("/api/todo")
View Full Code Here

        verifyZeroInteractions(todoServiceMock);
    }

    @Test
    public void add_NewTodoEntry_ShouldAddTodoEntryAndReturnAddedEntry() throws Exception {
        TodoDTO dto = new TodoDTOBuilder()
                .description("description")
                .title("title")
                .build();

        Todo added = new TodoBuilder()
View Full Code Here

        verifyNoMoreInteractions(todoServiceMock);
    }

    @Test
    public void update_EmptyTodoEntry_ShouldReturnValidationErrorForTitle() throws Exception {
        TodoDTO dto = new TodoDTOBuilder()
                .id(1L)
                .build();

        mockMvc.perform(put("/api/todo/{id}", 1L)
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
View Full Code Here

    @Test
    public void update_TitleAndDescriptionAreTooLong_ShouldReturnValidationErrorsForTitleAndDescription() throws Exception {
        String title = TestUtil.createStringWithLength(Todo.MAX_LENGTH_TITLE + 1);
        String description = TestUtil.createStringWithLength(Todo.MAX_LENGTH_DESCRIPTION + 1);

        TodoDTO dto = new TodoDTOBuilder()
                .id(1L)
                .description(description)
                .title(title)
                .build();
View Full Code Here

        service = new RepositoryTodoService(repositoryMock);
    }

    @Test
    public void add_NewTodoEntry_ShouldSaveTodoEntry() {
        TodoDTO dto = new TodoDTOBuilder()
                .description(DESCRIPTION)
                .title(TITLE)
                .build();

        service.add(dto);
View Full Code Here

TOP

Related Classes of net.petrikainulainen.spring.testmvc.todo.dto.TodoDTOBuilder

Copyright © 2018 www.massapicom. 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.