Package org.baeldung.persistence.model

Examples of org.baeldung.persistence.model.Foo


        service.create(entity);
    }

    @Test(expected = DataAccessException.class)
    public final void temp_whenInvalidEntityIsCreated_thenDataException() {
        service.create(new Foo());
    }
View Full Code Here


        service.create(new Foo());
    }

    @Test
    public final void whenEntityIsCreated_thenFound() {
        final Foo fooEntity = new Foo("abc");
        service.create(fooEntity);
        final Foo found = service.findOne(fooEntity.getId());
        Assert.assertNotNull(found);
    }
View Full Code Here

    // API

    @Override
    public final void create() {
        create(new Foo(randomAlphabetic(6)));
    }
View Full Code Here

        create(new Foo(randomAlphabetic(6)));
    }

    @Override
    public final String createAsUri() {
        return createAsUri(new Foo(randomAlphabetic(6)));
    }
View Full Code Here

    // API

    @Override
    public final void create() {
        create(new Foo(randomAlphabetic(6)));
    }
View Full Code Here

        create(new Foo(randomAlphabetic(6)));
    }

    @Override
    public final String createAsUri() {
        return createAsUri(new Foo(randomAlphabetic(6)));
    }
View Full Code Here

    }

    @Test
    public void whenResourceIsCreated_thenUriOfTheNewlyCreatedResourceIsDiscoverable() {
        // When
        final Foo newResource = new Foo(randomAlphabetic(6));
        final Response createResp = givenAuth().contentType(MediaType.APPLICATION_JSON_VALUE).body(newResource).post(getURL());
        final String uriOfNewResource = createResp.getHeader(HttpHeaders.LOCATION);

        // Then
        final Response response = givenAuth().header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE).get(uriOfNewResource);

        final Foo resourceFromServer = response.body().as(Foo.class);
        assertThat(newResource, equalTo(resourceFromServer));
    }
View Full Code Here

    // read - one

    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    @ResponseBody
    public Foo findById(@PathVariable("id") final Long id, final HttpServletResponse response) {
        final Foo resourceById = RestPreconditions.checkFound(service.findOne(id));

        eventPublisher.publishEvent(new SingleResourceRetrievedEvent(this, response));
        return resourceById;
    }
View Full Code Here

        //
    }

    @Test
    public final void whenEntityIsCreated_thenNoExceptions() {
        service.create(new Foo(randomAlphabetic(6)));
    }
View Full Code Here

        service.create(new Foo(randomAlphabetic(6)));
    }

    @Test(expected = DataIntegrityViolationException.class)
    public final void whenInvalidEntityIsCreated_thenDataException() {
        service.create(new Foo());
    }
View Full Code Here

TOP

Related Classes of org.baeldung.persistence.model.Foo

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.