1 /******************************************************************************* 2 * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * Marc R. Hoffmann - initial API and implementation 10 * 11 *******************************************************************************/ 12 package org.jacoco.examples; 13 14 import static org.jacoco.examples.ConsoleOutput.containsLine; 15 16 import org.junit.Rule; 17 import org.junit.Test; 18 19 /** 20 * Tests for {@link CoreTutorial}. 21 */ 22 public class CoreTutorialTest { 23 24 @Rule 25 public ConsoleOutput console = new ConsoleOutput(); 26 27 @Test 28 public void testRunExample() throws Exception { 29 new CoreTutorial(console.stream).execute(); 30 31 console.expect(containsLine("0 of 3 methods missed")); 32 console.expect(containsLine("1 of 5 complexity missed")); 33 console.expect(containsLine("Line 46: ")); 34 console.expect(containsLine("Line 47: green")); 35 console.expect(containsLine("Line 48: yellow")); 36 console.expect(containsLine("Line 49: red")); 37 } 38 } 39