diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-08-30 22:13:04 +0600 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-08-30 22:13:04 +0600 |
commit | e69ba4dbb015949c5d84ba7bbb0b53efac28bb23 (patch) | |
tree | 44cbe6d78216fcb3c37c0aca1dc7ed3fc09906fa /org.jacoco.report.test/src/org/jacoco/report/MemoryMultiReportOutput.java | |
parent | a888d873ac20357a4a11029bc84c5c4b48e394a3 (diff) | |
download | platform_external_jacoco-e69ba4dbb015949c5d84ba7bbb0b53efac28bb23.tar.gz platform_external_jacoco-e69ba4dbb015949c5d84ba7bbb0b53efac28bb23.tar.bz2 platform_external_jacoco-e69ba4dbb015949c5d84ba7bbb0b53efac28bb23.zip |
Fix EOLs
Diffstat (limited to 'org.jacoco.report.test/src/org/jacoco/report/MemoryMultiReportOutput.java')
-rw-r--r-- | org.jacoco.report.test/src/org/jacoco/report/MemoryMultiReportOutput.java | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/org.jacoco.report.test/src/org/jacoco/report/MemoryMultiReportOutput.java b/org.jacoco.report.test/src/org/jacoco/report/MemoryMultiReportOutput.java index d6e492cb..5d51d2fa 100644 --- a/org.jacoco.report.test/src/org/jacoco/report/MemoryMultiReportOutput.java +++ b/org.jacoco.report.test/src/org/jacoco/report/MemoryMultiReportOutput.java @@ -1,86 +1,86 @@ -/*******************************************************************************
- * Copyright (c) 2009, 2012 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.report;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * In-memory report output for test purposes.
- */
-public class MemoryMultiReportOutput implements IMultiReportOutput {
-
- private final Map<String, ByteArrayOutputStream> files = new HashMap<String, ByteArrayOutputStream>();
-
- private final Set<String> open = new HashSet<String>();
-
- private boolean closed = false;
-
- public OutputStream createFile(final String path) throws IOException {
- assertFalse("Duplicate output " + path, files.containsKey(path));
- open.add(path);
- final ByteArrayOutputStream out = new ByteArrayOutputStream() {
- @Override
- public void close() throws IOException {
- open.remove(path);
- super.close();
- }
- };
- files.put(path, out);
- return out;
- }
-
- public void close() throws IOException {
- closed = true;
- }
-
- public void assertEmpty() {
- assertEquals(Collections.emptySet(), files.keySet());
- }
-
- public void assertFile(String path) {
- assertNotNull(String.format("Missing file %s. Actual files are %s.",
- path, files.keySet()), files.get(path));
- }
-
- public void assertSingleFile(String path) {
- assertEquals(Collections.singleton(path), files.keySet());
- }
-
- public byte[] getFile(String path) {
- assertFile(path);
- return files.get(path).toByteArray();
- }
-
- public InputStream getFileAsStream(String path) {
- return new ByteArrayInputStream(getFile(path));
- }
-
- public void assertAllClosed() {
- assertEquals(Collections.emptySet(), open);
- assertTrue(closed);
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2009, 2012 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.report; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * In-memory report output for test purposes. + */ +public class MemoryMultiReportOutput implements IMultiReportOutput { + + private final Map<String, ByteArrayOutputStream> files = new HashMap<String, ByteArrayOutputStream>(); + + private final Set<String> open = new HashSet<String>(); + + private boolean closed = false; + + public OutputStream createFile(final String path) throws IOException { + assertFalse("Duplicate output " + path, files.containsKey(path)); + open.add(path); + final ByteArrayOutputStream out = new ByteArrayOutputStream() { + @Override + public void close() throws IOException { + open.remove(path); + super.close(); + } + }; + files.put(path, out); + return out; + } + + public void close() throws IOException { + closed = true; + } + + public void assertEmpty() { + assertEquals(Collections.emptySet(), files.keySet()); + } + + public void assertFile(String path) { + assertNotNull(String.format("Missing file %s. Actual files are %s.", + path, files.keySet()), files.get(path)); + } + + public void assertSingleFile(String path) { + assertEquals(Collections.singleton(path), files.keySet()); + } + + public byte[] getFile(String path) { + assertFile(path); + return files.get(path).toByteArray(); + } + + public InputStream getFileAsStream(String path) { + return new ByteArrayInputStream(getFile(path)); + } + + public void assertAllClosed() { + assertEquals(Collections.emptySet(), open); + assertTrue(closed); + } + +} |