Clover Coverage Report - KS Contract Documentation Generator 0.0.1-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
../../../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
11   57   6   3.67
6   30   0.55   3
3     2  
1    
 
  OrchObjValidator       Line # 28 11 0% 6 20 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2009 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.osedu.org/licenses/ECL-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16    package org.kuali.student.contract.model.validation;
17   
18    import org.kuali.student.contract.model.OrchObj;
19   
20    import java.util.ArrayList;
21    import java.util.Collection;
22    import java.util.List;
23   
24    /**
25    * This validates a constraint.
26    * @author nwright
27    */
 
28    public class OrchObjValidator implements ModelValidator {
29   
30    private OrchObj orch;
31   
 
32  0 toggle public OrchObjValidator(OrchObj orch) {
33  0 this.orch = orch;
34    }
35    private Collection errors;
36   
 
37  0 toggle @Override
38    public Collection<String> validate() {
39  0 this.errors = new ArrayList();
40  0 if (orch.getXmlType().equals("")) {
41  0 this.addError("XML Type is required");
42    }
43    // TODO: more validation
44  0 return this.errors;
45    }
46   
 
47  0 toggle private void addError(String msg) {
48  0 String key = orch.getId();
49  0 if (key.equals("")) {
50  0 key = "";
51    }
52  0 String error = "Error in: " + key + ": " + msg;
53  0 if (!errors.contains(error)) {
54  0 errors.add(error);
55    }
56    }
57    }