Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RaiseException |
|
| 1.3333333333333333;1.333 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 | * contributor license agreements. See the NOTICE file distributed with | |
4 | * this work for additional information regarding copyright ownership. | |
5 | * The ASF licenses this file to you under the Apache License, Version 2.0 | |
6 | * (the "License"); you may not use this file except in compliance with | |
7 | * the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | * | |
17 | * $Id: RaiseException.java 477032 2006-11-20 04:17:39Z gvanmatre $ | |
18 | */ | |
19 | ||
20 | package org.apache.shale.examples.test.view; | |
21 | ||
22 | import javax.faces.event.ActionEvent; | |
23 | import javax.faces.event.ValueChangeEvent; | |
24 | ||
25 | import org.apache.shale.view.AbstractViewController; | |
26 | ||
27 | /** | |
28 | * <p>Tests for handling exceptions.</p> | |
29 | */ | |
30 | 0 | public class RaiseException extends AbstractViewController { |
31 | ||
32 | ||
33 | // -------------------------------------------------------------- Properties | |
34 | ||
35 | ||
36 | // The "Recorder" object for this request | |
37 | 0 | private Recorder recorder = null; |
38 | public Recorder getRecorder() { | |
39 | 0 | return this.recorder; |
40 | } | |
41 | public void setRecorder(Recorder recorder) { | |
42 | 0 | this.recorder = recorder; |
43 | 0 | } |
44 | ||
45 | ||
46 | // ------------------------------------------------------- Lifecycle Methods | |
47 | ||
48 | ||
49 | /** | |
50 | * <p>Record an init event.</p> | |
51 | */ | |
52 | public void init() { | |
53 | 0 | getRecorder().record("init"); |
54 | 0 | System.out.println("RaiseException.init()"); |
55 | 0 | } |
56 | ||
57 | ||
58 | /** | |
59 | * <p>Record a preprocess event.</p> | |
60 | */ | |
61 | public void preprocess() { | |
62 | 0 | getRecorder().record("preprocess"); |
63 | 0 | System.out.println("RaiseException.preprocess()"); |
64 | 0 | } |
65 | ||
66 | ||
67 | /** | |
68 | * <p>Record a prerender event.</p> | |
69 | */ | |
70 | public void prerender() { | |
71 | 0 | getRecorder().record("prerender"); |
72 | 0 | System.out.println("RaiseException.prerender()"); |
73 | 0 | } |
74 | ||
75 | ||
76 | /** | |
77 | * <p>Record a destroy event.</p> | |
78 | */ | |
79 | public void destroy() { | |
80 | 0 | getRecorder().record("destroy"); |
81 | 0 | System.out.println("RaiseException.destroy()"); |
82 | 0 | } |
83 | ||
84 | /** | |
85 | * <p>Raises an unchecked exception from an action callback.</p> | |
86 | * | |
87 | * @return null | |
88 | */ | |
89 | public String throwActionException() { | |
90 | 0 | getRecorder().record("throwActionException"); |
91 | 0 | System.out.println("RaiseException.throwActionException()"); |
92 | 0 | throw new NullPointerException("throwActionException"); |
93 | } | |
94 | ||
95 | /** | |
96 | * <p>Raises an unchecked exception from an action listener | |
97 | * binding event.</p> | |
98 | * | |
99 | * @param event action event | |
100 | */ | |
101 | public void throwActionListenerException(ActionEvent event) { | |
102 | 0 | getRecorder().record("throwActionListenerException"); |
103 | 0 | System.out.println("RaiseException.throwActionListenerException(ActionEvent)"); |
104 | 0 | throw new NullPointerException("throwActionListenerException"); |
105 | } | |
106 | ||
107 | /** | |
108 | * <p>Raises an unchecked exception from a value change listener | |
109 | * callback.</p> | |
110 | * | |
111 | * @param event value change listener event | |
112 | */ | |
113 | public void throwValueChangeListenerException(ValueChangeEvent event) { | |
114 | 0 | getRecorder().record("throwValueChangeListenerException"); |
115 | 0 | System.out.println("RaiseException.throwValueChangeListenerException(ValueChangeEvent)"); |
116 | 0 | throw new NullPointerException("throwValueChangeListenerException"); |
117 | ||
118 | } | |
119 | ||
120 | } |