01: /*
02: * Copyright (C) The Spice Group. All rights reserved.
03: *
04: * This software is published under the terms of the Spice
05: * Software License version 1.1, a copy of which has been included
06: * with this distribution in the LICENSE.txt file.
07: */
08: package org.codehaus.dna.tools.verifier;
09:
10: import org.codehaus.dna.tools.verifier.VerifyIssue;
11:
12: import junit.framework.TestCase;
13:
14: /**
15: *
16: * @author Peter Donald
17: * @version $Revision: 1.1 $ $Date: 2004/04/18 20:13:44 $
18: */
19: public class VerifyIssueTestCase extends TestCase {
20: public void testVerifyIssueAsError() throws Exception {
21: final String description = "Here I stand.";
22: final int level = VerifyIssue.ERROR;
23: final VerifyIssue issue = new VerifyIssue(level, description);
24: assertEquals("description", description, issue.getDescription());
25: assertEquals("isError", true, issue.isError());
26: assertEquals("isWarning", false, issue.isWarning());
27: }
28:
29: public void testVerifyIssueAsWarning() throws Exception {
30: final String description = "Here I stand.";
31: final int level = VerifyIssue.WARNING;
32: final VerifyIssue issue = new VerifyIssue(level, description);
33: assertEquals("description", description, issue.getDescription());
34: assertEquals("isError", false, issue.isError());
35: assertEquals("isWarning", true, issue.isWarning());
36: }
37:
38: public void testVerifyIssueAsNotice() throws Exception {
39: final String description = "Here I stand.";
40: final int level = VerifyIssue.NOTICE;
41: final VerifyIssue issue = new VerifyIssue(level, description);
42: assertEquals("description", description, issue.getDescription());
43: assertEquals("isError", false, issue.isError());
44: assertEquals("isWarning", false, issue.isWarning());
45: }
46:
47: public void testNulldescriptionPassedToCtor() throws Exception {
48: try {
49: new VerifyIssue(VerifyIssue.ERROR, null);
50: } catch (final NullPointerException npe) {
51: assertEquals("npe.getMessage()", "description", npe
52: .getMessage());
53: return;
54: }
55: fail("Expected to fail due to null description passed into Ctor");
56: }
57: }
|