Last change
on this file since 1040 was
1032,
checked in by adeicke, 11 years ago
|
Refactored defectDescription method.
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.3 KB
|
Line | |
---|
1 | package de.ugoe.cs.autoquest.usability.util;
|
---|
2 |
|
---|
3 | import java.util.Map;
|
---|
4 |
|
---|
5 | import javax.annotation.Nullable;
|
---|
6 |
|
---|
7 | import org.apache.commons.lang.StringUtils;
|
---|
8 |
|
---|
9 | import lombok.AccessLevel;
|
---|
10 | import lombok.NoArgsConstructor;
|
---|
11 |
|
---|
12 | import com.google.common.base.Predicate;
|
---|
13 | import com.google.common.collect.Iterables;
|
---|
14 |
|
---|
15 | import de.ugoe.cs.autoquest.usability.DefectDescription;
|
---|
16 | import de.ugoe.cs.autoquest.usability.ParameterFragment;
|
---|
17 |
|
---|
18 | @NoArgsConstructor(access = AccessLevel.PRIVATE)
|
---|
19 | public class DefectDescriptionExtensionMethods {
|
---|
20 |
|
---|
21 | public static boolean containsParameterFragments(DefectDescription defectDescription) {
|
---|
22 | return Iterables.any(defectDescription.getTextFragmentOrParameterFragment(), new Predicate<Object>() {
|
---|
23 |
|
---|
24 | @Override
|
---|
25 | public boolean apply(@Nullable Object fragment) {
|
---|
26 | return fragment instanceof ParameterFragment;
|
---|
27 | }
|
---|
28 |
|
---|
29 | });
|
---|
30 | }
|
---|
31 |
|
---|
32 | public static boolean isParameterFragment(Object object) {
|
---|
33 | return object instanceof ParameterFragment;
|
---|
34 | }
|
---|
35 |
|
---|
36 | public static String getValueOrEmptyString(Map<String, String> stringKeyValueMap, String key) {
|
---|
37 | return stringKeyValueMap != null && stringKeyValueMap.containsKey(key) ? stringKeyValueMap.get(key) : StringUtils.EMPTY;
|
---|
38 | }
|
---|
39 |
|
---|
40 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.