EMMA Coverage Report (generated Wed Feb 13 07:49:24 ICT 2008)
[all classes][net.sourceforge.hiveboard.business]

COVERAGE SUMMARY FOR SOURCE FILE [SecurityChecks.java]

nameclass, %method, %block, %line, %
SecurityChecks.java100% (1/1)88%  (7/8)49%  (37/75)61%  (14/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SecurityChecks100% (1/1)88%  (7/8)49%  (37/75)61%  (14/23)
SecurityChecks (): void 0%   (0/1)0%   (0/3)0%   (0/2)
checkError (String): void 100% (1/1)38%  (3/8)67%  (2/3)
checkEmptyBoard (Board, String): void 100% (1/1)50%  (5/10)67%  (2/3)
checkInitiator (int, Board, String): void 100% (1/1)50%  (5/10)67%  (2/3)
checkNotInitiator (int, Board, String): void 100% (1/1)50%  (5/10)67%  (2/3)
checkWriter (int, Board, String): void 100% (1/1)50%  (5/10)67%  (2/3)
checkParticipant (int, Board, String): void 100% (1/1)58%  (7/12)67%  (2/3)
checkPresent (int, Board, String): void 100% (1/1)58%  (7/12)67%  (2/3)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hiveboard.business;
16 
17import net.sourceforge.hiveboard.Board;
18import net.sourceforge.hivelock.SecurityException;
19 
20final public class SecurityChecks
21{
22        private SecurityChecks()
23        {
24        }
25        
26        static public void        checkError(String error)
27        {
28                if (error != null)
29                {
30                        throw new SecurityException(error);
31                }
32        }
33        
34        static public void        checkWriter(int who, Board board, String error)
35        {
36                if (board.getWriter() != who)
37                {
38                        throw new SecurityException(error);
39                }
40        }
41        
42        static public void        checkNotInitiator(int who, Board board, String error)
43        {
44                if (board.getInitiator() == who)
45                {
46                        throw new SecurityException(error);
47                }
48        }
49        
50        static public void        checkEmptyBoard(Board board, String error)
51        {
52                if (!board.getPresents().isEmpty())
53                {
54                        throw new SecurityException(error);
55                }
56        }
57 
58        static public void        checkParticipant(int who, Board board, String error)
59        {
60                if (!board.getParticipants().contains(who))
61                {
62                        throw new SecurityException(error);
63                }
64        }
65 
66        static public void        checkPresent(int who, Board board, String error)
67        {
68                if (!board.getPresents().contains(who))
69                {
70                        throw new SecurityException(error);
71                }
72        }
73 
74        static public void        checkInitiator(int who, Board board, String error)
75        {
76                if (board.getInitiator() != who)
77                {
78                        throw new SecurityException(error);
79                }
80        }
81}

[all classes][net.sourceforge.hiveboard.business]
EMMA 2.0.5312 (C) Vladimir Roubtsov