Package org.sete.domain.type

Examples of org.sete.domain.type.ScienceProjectCategoryType


  @Test
  public void testCreateNewScienceProjectCategoryRuleException() {
    CreateScienceProjectCategoryVo cspcvo = new CreateScienceProjectCategoryVo();
        cspcvo.setProjectCategoryName("test category");
        cspcvo.setProjectCategoryDescription("test category description");
        ScienceProjectCategoryType spct = new ScienceProjectCategoryType();
        spct.setLabel("test category");
        EasyMock.expect(mockSPCDao.findByProjectCategoryName(cspcvo.getProjectCategoryName())).andReturn(spct);
    mockSPCDao.saveScienceProjectCategory((ScienceProjectCategoryType)EasyMock.anyObject());
    EasyMock.expectLastCall();
    EasyMock.replay(mockSPCDao);
   
View Full Code Here


   * Test method for {@link org.sete.service.project.ScienceProjectCategoryServiceImpl#deleteScienceProjectCategory(org.sete.domain.type.ScienceProjectCategoryType)}.
   * testing successful deletion of a project category
   */
  @Test
  public void testDeleteScienceProjectCategory() {
    ScienceProjectCategoryType spct = new ScienceProjectCategoryType();
    spct.setId(1);
    EasyMock.expect(mockSPCDao.isProjectCategoryInUse(spct.getId())).andReturn(Boolean.FALSE);
    mockSPCDao.deleteScienceProjectCategory(spct);
    EasyMock.expectLastCall();
    EasyMock.replay(mockSPCDao);
    spcs.deleteScienceProjectCategory(spct);
  }
View Full Code Here

   * Test method for {@link org.sete.service.project.ScienceProjectCategoryServiceImpl#deleteScienceProjectCategory(org.sete.domain.type.ScienceProjectCategoryType)}.
   * testing Business rule exception that a project category is in use by other projects, so cannot be deleted.
   */
  @Test
  public void testDeleteScienceProjectCategoryRuleException() {
    ScienceProjectCategoryType spct = new ScienceProjectCategoryType();
    spct.setId(1);
    EasyMock.expect(mockSPCDao.isProjectCategoryInUse(spct.getId())).andReturn(Boolean.TRUE);
    mockSPCDao.deleteScienceProjectCategory(spct);
    EasyMock.expectLastCall();
    EasyMock.replay(mockSPCDao);
   
    try{    
View Full Code Here

  public void testEditScienceProjectCategory() {
    EditScienceProjectCategoryVo espcvo = new EditScienceProjectCategoryVo();
    espcvo.setProjectCategoryName("test category");
    espcvo.setProjectCategoryDescription("edited test description");
   
    ScienceProjectCategoryType spct = new ScienceProjectCategoryType();
    spct.setId(1);
    spct.setKey("test_category");
    spct.setLabel("test category");
    EasyMock.expect(mockSPCDao.findByProjectCategoryName(espcvo.getProjectCategoryName())).andReturn(spct);
    mockSPCDao.saveScienceProjectCategory(spct);
    EasyMock.expectLastCall();
    EasyMock.expect(mockSPCDao.findByProjectCategoryKey("test_category")).andReturn(spct);
    EasyMock.replay(mockSPCDao);
   
    spcs.editScienceProjectCategory(espcvo);
    assertEquals(spcs.loadScienceProjectCategory(spct.getKey()).getProjectCategoryDescription(), "edited test description");
  }
View Full Code Here

  /**
   * Test method for {@link org.sete.service.project.ScienceProjectCategoryServiceImpl#loadAllScienceProjectCategories()}.
   */
  @Test
  public void testLoadAllScienceProjectCategories(){
    ScienceProjectCategoryType spct1 = new ScienceProjectCategoryType();
    ScienceProjectCategoryType spct2 = new ScienceProjectCategoryType();
    spct1.setId(1);
    spct2.setId(2);
    List<ScienceProjectCategoryType> projectCategories = new ArrayList<ScienceProjectCategoryType>();
    projectCategories.add(spct1);
    projectCategories.add(spct2);
   
    EasyMock.expect(mockSPCDao.getAllScienceProjectCategories()).andReturn(projectCategories);
View Full Code Here

  /**
   * Test method for {@link org.sete.service.project.ScienceProjectCategoryServiceImpl#loadScienceProjectCategory(String projectCategoryKey)}.
   */
  @Test
  public void loadScienceProjectCategory(){
    ScienceProjectCategoryType spct = new ScienceProjectCategoryType();
    spct.setId(1);
    spct.setKey("test_category");
    spct.setLabel("test category");
    spct.setDescription("test category description");
   
    EasyMock.expect(mockSPCDao.findByProjectCategoryKey("test_category")).andReturn(spct);
    EasyMock.replay(mockSPCDao);
   
    ScienceProjectCategoryVo spcvo = spcs.loadScienceProjectCategory("test_category");
View Full Code Here

        input.setClassName("org.sete.domain.type.ScienceProjectCategoryType");
        input.setKey("chemistry");

        TypeDataVo output = service.loadTypeData(input);

        ScienceProjectCategoryType spct =
            (ScienceProjectCategoryType)TypeUtil.forKey(Class.forName(input.getClassName()),
                                                        input.getKey());

        assertEquals("Classnames should match.", output.getClassName(),
                     spct.getClass().getName());

        assertEquals("Keys should mtach.", output.getKey(), spct.getKey());
        assertEquals("Labels should match.", output.getLabel(), spct.getLabel());
        assertEquals("Descriptions should match.", output.getDescription(), spct.getDescription());
        assertEquals("Long Descriptions should match.", output.getLongDescription(), spct.getLongDescription());
    }
View Full Code Here

        SeteUser p = new SeteUser();
        p.setId(toTestID);
        List<ScienceProject> projects = new ArrayList<ScienceProject>();
        ScienceProject proj = new ScienceProject();
        projects.add(proj);
        ScienceProjectCategoryType t = new ScienceProjectCategoryType();
        t.setLabel("");
        Set<SeteUser> students = new HashSet<SeteUser>();
        SeteUser stud = new SeteUser();
        stud.setFirstName("");
        stud.setLastName("");
        students.add(stud);
View Full Code Here

        urt.setLongDescription("STUDENT Long Description");
        types.add(urt);
    }

    private static void createScienceProjectCategoryTypes(List<AbstractLookupType> types) {
        ScienceProjectCategoryType spct = new ScienceProjectCategoryType();
        spct.setId(22);
        spct.setKey("chemistry");
        spct.setLabel("Chemistry Label");
        spct.setDescription("Chemistry Description");
        spct.setLongDescription("Chemistry Long Description");
        types.add(spct);

        spct = new ScienceProjectCategoryType();
        spct.setId(23);
        spct.setKey("biology");
        spct.setLabel("Biology Label");
        spct.setDescription("Biology Description");
        spct.setLongDescription("Biology Long Description");
        types.add(spct);

        spct = new ScienceProjectCategoryType();
        spct.setId(24);
        spct.setKey("physics");
        spct.setLabel("Physics Label");
        spct.setDescription("Physics Description");
        spct.setLongDescription("Physics Long Description");
        types.add(spct);
    }
View Full Code Here

        SeteUser p = new SeteUser();
        p.setId(toTestID);
        List<ScienceProject> projects = new ArrayList<ScienceProject>();
        ScienceProject proj = new ScienceProject();
        projects.add(proj);
        ScienceProjectCategoryType t = new ScienceProjectCategoryType();
        t.setLabel("");
        Set<SeteUser> students = new HashSet<SeteUser>();
        SeteUser stud = new SeteUser();
        stud.setFirstName("");
        stud.setLastName("");
        students.add(stud);
View Full Code Here

TOP

Related Classes of org.sete.domain.type.ScienceProjectCategoryType

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.