Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
InverseGroupMatcher |
|
| 3.0;3 |
1 | package org.apache.maven.surefire.group.match; | |
2 | /* | |
3 | * Licensed to the Apache Software Foundation (ASF) under one | |
4 | * or more contributor license agreements. See the NOTICE file | |
5 | * distributed with this work for additional information | |
6 | * regarding copyright ownership. The ASF licenses this file | |
7 | * to you under the Apache License, Version 2.0 (the | |
8 | * "License"); you may not use this file except in compliance | |
9 | * with the License. You may obtain a copy of the License at | |
10 | * | |
11 | * http://www.apache.org/licenses/LICENSE-2.0 | |
12 | * | |
13 | * Unless required by applicable law or agreed to in writing, | |
14 | * software distributed under the License is distributed on an | |
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
16 | * KIND, either express or implied. See the License for the | |
17 | * specific language governing permissions and limitations | |
18 | * under the License. | |
19 | */ | |
20 | ||
21 | ||
22 | public class InverseGroupMatcher | |
23 | implements GroupMatcher | |
24 | { | |
25 | ||
26 | private final GroupMatcher matcher; | |
27 | ||
28 | public InverseGroupMatcher( GroupMatcher matcher ) | |
29 | 4 | { |
30 | 4 | this.matcher = matcher; |
31 | 4 | } |
32 | ||
33 | public boolean enabled( Class<?>... cats ) | |
34 | { | |
35 | 6 | return cats == null || !matcher.enabled( cats ); |
36 | } | |
37 | ||
38 | public boolean enabled( String... cats ) | |
39 | { | |
40 | 0 | return cats == null || !matcher.enabled( cats ); |
41 | } | |
42 | ||
43 | @Override | |
44 | public String toString() | |
45 | { | |
46 | 0 | return "NOT " + matcher; |
47 | } | |
48 | ||
49 | @Override | |
50 | public int hashCode() | |
51 | { | |
52 | 0 | final int prime = 31; |
53 | 0 | int result = 1; |
54 | 0 | result = prime * result + ( ( matcher == null ) ? 0 : matcher.hashCode() ); |
55 | 0 | return result; |
56 | } | |
57 | ||
58 | @Override | |
59 | public boolean equals( Object obj ) | |
60 | { | |
61 | 0 | if ( this == obj ) |
62 | { | |
63 | 0 | return true; |
64 | } | |
65 | 0 | if ( obj == null ) |
66 | { | |
67 | 0 | return false; |
68 | } | |
69 | 0 | if ( getClass() != obj.getClass() ) |
70 | { | |
71 | 0 | return false; |
72 | } | |
73 | 0 | InverseGroupMatcher other = (InverseGroupMatcher) obj; |
74 | 0 | if ( matcher == null ) |
75 | { | |
76 | 0 | if ( other.matcher != null ) |
77 | { | |
78 | 0 | return false; |
79 | } | |
80 | } | |
81 | 0 | else if ( !matcher.equals( other.matcher ) ) |
82 | { | |
83 | 0 | return false; |
84 | } | |
85 | 0 | return true; |
86 | } | |
87 | ||
88 | public void loadGroupClasses( ClassLoader cloader ) | |
89 | { | |
90 | 0 | matcher.loadGroupClasses( cloader ); |
91 | 0 | } |
92 | ||
93 | } |