Skip to content

Package: StepData

StepData

nameinstructionbranchcomplexitylinemethod
StepData()
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
clear()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
contains(String)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
get(String)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getKeys()
M: 22 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
put(String, Object)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
remove(String)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2020 Eurotech and/or its affiliates and others
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License v1.0
6: * which accompanies this distribution, and is available at
7: * http://www.eclipse.org/legal/epl-v10.html
8: *
9: * Contributors:
10: * Eurotech
11: *******************************************************************************/
12: package org.eclipse.kapua.qa.common;
13:
14: import java.util.ArrayList;
15: import java.util.HashMap;
16: import java.util.Iterator;
17: import java.util.List;
18: import java.util.Map;
19: import java.util.Set;
20:
21: import javax.inject.Singleton;
22:
23: /**
24: * Simple container for between step data that is persisted between steps and
25: * between step implementation classes.
26: */
27: @Singleton
28: public class StepData {
29:
30: /**
31: * Generic map that accepts string key that represents data and data
32: * as any object.
33: * Dev-user has to know type of data stored under specified key.
34: * Key could be class name.
35: */
36: Map<String, Object> stepDataMap;
37:
38: public StepData() {
39: stepDataMap = new HashMap<>();
40: }
41:
42: public void clear() {
43: stepDataMap.clear();
44: }
45:
46: public void put(String key, Object value) {
47: stepDataMap.put(key, value);
48: }
49:
50: public Object get(String key) {
51: return stepDataMap.get(key);
52: }
53:
54: public boolean contains(String key) {
55: return stepDataMap.containsKey(key);
56: }
57:
58: public void remove(String key) {
59: stepDataMap.remove(key);
60: }
61:
62: public List<String> getKeys() {
63: List<String> keys = new ArrayList<>();
64:
65: Set<String> setOfKeys = stepDataMap.keySet();
66: Iterator<String> keyIterator = setOfKeys.iterator();
67:• while (keyIterator.hasNext()) {
68: keys.add(keyIterator.next());
69: }
70:
71: return keys;
72: }
73: }