Package org.apache.rave.model

Examples of org.apache.rave.model.Group


        assertThat(converter.convert(group), is(sameInstance(group)));
    }

    @Test
    public void nullConversion() {
        Group category = null;
        assertThat(converter.convert(category), is(nullValue()));
    }
View Full Code Here


    }

    @Test
    public void getByTitle() {
        String title = "title";
        Group group = new GroupImpl();
        group.setId("1");
        group.setTitle(title);
        expect(groupTemplate.findOne(Query.query(Criteria.where("title").is(title)))).andReturn(group);
        replay(groupTemplate);

        Group fromRepo = repo.findByTitle(title);
        assertThat(fromRepo.getTitle(), is(equalTo(title)));
    }
View Full Code Here

    @Test
    public void get() {
        String title = "title";
        String id = "1";
        Group group = new GroupImpl();
        group.setId(id);
        group.setTitle(title);
        expect(groupTemplate.get(id)).andReturn(group);
        replay(groupTemplate);

        Group fromRepo = repo.get(id);
        assertThat(fromRepo.getId(), is(equalTo(id)));
        assertThat(fromRepo.getTitle(), is(equalTo(title)));
    }
View Full Code Here

    }

    @Test
    public void save(){
        String title = "TITLE";
        Group group = new GroupImpl();
        group.setId("1");
        group.setTitle(title);
        expect(groupTemplate.save(group)).andReturn(group);
        replay(groupTemplate);
        Group returned = repo.save(group);
        verify(groupTemplate);
        assertThat(returned, is(sameInstance(group)));
    }
View Full Code Here


    @Test
    public void delete(){
        String id ="id";
        Group group = new GroupImpl();
        group.setId(id);
        group.setTitle("title");
        groupTemplate.remove(Query.query(Criteria.where("_id").is(id)));
        expectLastCall();
        replay(groupTemplate);

        repo.delete(group);
View Full Code Here

        service = new DefaultGroupService(repository);
    }

    @Test
    public void getGroupById() {
        Group group = createGroup("test");
        expect(repository.get("1")).andReturn(group);
        replay(repository);
        Group sGroup = service.getGroupByID("1");
        assertEquals(sGroup, group);
        verify(repository);
    }
View Full Code Here

    @Test
    public void getGroupById_NotFound() {
        final String entityId = "456";
        expect(repository.get(entityId)).andReturn(null);
        replay(repository);
        Group sGroup = service.getGroupByID(entityId);
        assertNull(sGroup);

        verify(repository);
    }
View Full Code Here

    }

    @Test
    public void allGroups() {
        List<Group> tags = new ArrayList<Group>();
        Group group = createGroup("test");
        tags.add(group);
        expect(repository.getAll()).andReturn(tags);
        replay(repository);
        List<Group> allGroups = service.getAllGroups();
        verify(repository);
View Full Code Here

        assertTrue(allGroups.size() > 0);
    }

    @Test
    public void findByTitle() {
        Group group = createGroup("test");
        expect(repository.findByTitle("test")).andReturn(group);
        expect(repository.findByTitle("TEST")).andReturn(group);
        expect(repository.findByTitle(" test")).andReturn(group);

    }
View Full Code Here

    }


    @Test
    public void convert_valid(){
        Group group = new GroupImpl();
        group.setId(USER1ID);
        group.setTitle("asdf");
        group.setDescription("Description");
        group.setMemberIds(Arrays.asList(new String[] {"1", "2", "3"}));
        group.setOwnerId(USER2ID);

        MongoDbGroup mongoGroup = converter.convert(group);
        assertThat(mongoGroup.getId(), is(equalTo(USER1ID)));
        assertThat(mongoGroup.getTitle(), is(equalTo("asdf")));
        assertThat(mongoGroup.getDescription(), is("Description"));
View Full Code Here

TOP

Related Classes of org.apache.rave.model.Group

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.