01: /**********************************************************************************
02: *
03: * $Id: GradebookManagerTest.java 20345 2007-01-16 20:25:32Z ray@media.berkeley.edu $
04: *
05: ***********************************************************************************
06: *
07: * Copyright (c) 2005 The Regents of the University of California, The MIT Corporation
08: *
09: * Licensed under the Educational Community License, Version 1.0 (the "License");
10: * you may not use this file except in compliance with the License.
11: * You may obtain a copy of the License at
12: *
13: * http://www.opensource.org/licenses/ecl1.php
14: *
15: * Unless required by applicable law or agreed to in writing, software
16: * distributed under the License is distributed on an "AS IS" BASIS,
17: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18: * See the License for the specific language governing permissions and
19: * limitations under the License.
20: *
21: **********************************************************************************/package org.sakaiproject.tool.gradebook.test;
22:
23: import junit.framework.Assert;
24:
25: import org.sakaiproject.tool.gradebook.Gradebook;
26:
27: /**
28: * TODO Document org.sakaiproject.tool.gradebook.test.GradebookManagerTest
29: *
30: * @author <a href="mailto:jholtzman@berkeley.edu">Josh Holtzman</a>
31: */
32: public class GradebookManagerTest extends GradebookTestBase {
33:
34: public void testCreateGradebook() throws Exception {
35: // Create a gradebook
36: String className = this .getClass().getName();
37: gradebookFrameworkService.addGradebook(className, className);
38: setComplete();
39: }
40:
41: public void testUpdateGradebook() throws Exception {
42: // Fetch the gradebook
43: Gradebook persistentGradebook = gradebookManager
44: .getGradebook(this .getClass().getName());
45:
46: // Modify the gradebook (including the grade mapping)
47: persistentGradebook.setAllAssignmentsEntered(true);
48: persistentGradebook.getSelectedGradeMapping().getGradeMap()
49: .put("A", new Double(99));
50:
51: // Update the gradebook
52: gradebookManager.updateGradebook(persistentGradebook);
53:
54: // Ensure that the DB update was successful
55: persistentGradebook = gradebookManager.getGradebook(this
56: .getClass().getName());
57: Assert
58: .assertTrue(persistentGradebook
59: .isAllAssignmentsEntered());
60: Assert.assertTrue(persistentGradebook.getSelectedGradeMapping()
61: .getGradeMap().get("A").equals(new Double(99)));
62: }
63:
64: }
|