blob: 5698594b88e7e3a1546031eec9ecf0c1d6f700cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*******************************************************************************
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.core.runtime;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import java.util.HashMap;
import java.util.Map;
import org.jacoco.core.data.ExecutionData;
import org.jacoco.core.data.IExecutionDataVisitor;
import org.jacoco.core.data.ISessionInfoVisitor;
import org.jacoco.core.data.SessionInfo;
class TestStorage implements IExecutionDataVisitor, ISessionInfoVisitor {
private final Map<Long, ExecutionData> data = new HashMap<Long, ExecutionData>();
private SessionInfo info;
public void assertSize(int size) {
assertEquals(size, data.size(), 0.0);
}
public ExecutionData getData(long classId) {
return data.get(Long.valueOf(classId));
}
public SessionInfo getSessionInfo() {
return info;
}
public void assertData(long classId, boolean[] expected) {
assertSame(expected, getData(classId).getProbes());
}
// === ICoverageDataVisitor ===
public void visitClassExecution(final ExecutionData ed) {
data.put(Long.valueOf(ed.getId()), ed);
}
// === ISessionInfoVisitor ===
public void visitSessionInfo(SessionInfo info) {
this.info = info;
}
}
|