Package org.apache.deltaspike.data.test.domain

Examples of org.apache.deltaspike.data.test.domain.Simple


    @Test
    public void should_refresh() throws Exception
    {
        // given
        final String name = "testRefresh";
        Simple simple = testData.createSimple(name);

        // when
        simple.setName("override");
        repo.refresh(simple);

        // then
        assertEquals(name, simple.getName());
    }
View Full Code Here


    @Test
    public void should_find_by_pk() throws Exception
    {
        // given
        Simple simple = testData.createSimple("testFindByPk");

        // when
        Simple find = repo.findBy(simple.getId());

        // then
        assertEquals(simple.getName(), find.getName());
    }
View Full Code Here

    @Test
    @SuppressWarnings("unchecked")
    public void should_find_by_example() throws Exception
    {
        // given
        Simple simple = testData.createSimple("testFindByExample");

        // when
        List<Simple> find = repo.findBy(simple, Simple_.name);

        // then
        assertNotNull(find);
        assertFalse(find.isEmpty());
        assertEquals(simple.getName(), find.get(0).getName());
    }
View Full Code Here

    @Test
    @SuppressWarnings("unchecked")
    public void should_find_by_example_with_start_and_max() throws Exception
    {
        // given
        Simple simple = testData.createSimple("testFindByExample1", Integer.valueOf(10));
        testData.createSimple("testFindByExample1", Integer.valueOf(10));

        // when
        List<Simple> find = repo.findBy(simple, 0, 1, Simple_.name, Simple_.counter);

        // then
        assertNotNull(find);
        assertFalse(find.isEmpty());
        assertEquals(1, find.size());
        assertEquals(simple.getName(), find.get(0).getName());
    }
View Full Code Here

    @Test
    @SuppressWarnings("unchecked")
    public void should_find_by_example_with_no_attributes() throws Exception
    {
        // given
        Simple simple = testData.createSimple("testFindByExample");
        SingularAttribute<Simple, ?>[] attributes = new SingularAttribute[] {};

        // when
        List<Simple> find = repo.findBy(simple, attributes);

        // then
        assertNotNull(find);
        assertFalse(find.isEmpty());
        assertEquals(simple.getName(), find.get(0).getName());
    }
View Full Code Here

    public void should_find_by_like()
    {
        // given
        testData.createSimple("testFindAll1");
        testData.createSimple("testFindAll2");
        Simple example = new Simple("test");

        // when
        List<Simple> find = repo.findByLike(example, Simple_.name);

        // then
View Full Code Here

    public void should_find_by_like_with_start_and_max()
    {
        // given
        testData.createSimple("testFindAll1");
        testData.createSimple("testFindAll2");
        Simple example = new Simple("test");

        // when
        List<Simple> find = repo.findByLike(example, 1, 10, Simple_.name);

        // then
View Full Code Here

    public void should_find_by_like_non_string()
    {
        // given
        testData.createSimple("testFindAll1", 1);
        testData.createSimple("testFindAll2", 2);
        Simple example = new Simple("test");
        example.setCounter(1);

        // when
        List<Simple> find = repo.findByLike(example, Simple_.name, Simple_.counter);

        // then
View Full Code Here

    @Test
    @SuppressWarnings("unchecked")
    public void should_count_with_attributes()
    {
        // given
        Simple simple = testData.createSimple("testFindAll1", Integer.valueOf(55));
        testData.createSimple("testFindAll2", Integer.valueOf(55));

        // when
        Long result = repo.count(simple, Simple_.name, Simple_.counter);
View Full Code Here

    @Test
    @SuppressWarnings("unchecked")
    public void should_count_with_no_attributes()
    {
        // given
        Simple simple = testData.createSimple("testFindAll1");
        testData.createSimple("testFindAll2");
        SingularAttribute<Simple, Object>[] attributes = new SingularAttribute[] {};

        // when
        Long result = repo.count(simple, attributes);
View Full Code Here

TOP

Related Classes of org.apache.deltaspike.data.test.domain.Simple

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.