|
| 1 | +/* |
| 2 | + * Copyright (C) 2006-2015 INRIA and contributors |
| 3 | + * Spoon - http://spoon.gforge.inria.fr/ |
| 4 | + * |
| 5 | + * This software is governed by the CeCILL-C License under French law and |
| 6 | + * abiding by the rules of distribution of free software. You can use, modify |
| 7 | + * and/or redistribute the software under the terms of the CeCILL-C license as |
| 8 | + * circulated by CEA, CNRS and INRIA at http://www.cecill.info. |
| 9 | + * |
| 10 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | + * FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details. |
| 13 | + * |
| 14 | + * The fact that you are presently reading this means that you have had |
| 15 | + * knowledge of the CeCILL-C license and that you accept its terms. |
| 16 | + */ |
| 17 | + |
| 18 | +package spoon.processing; |
| 19 | + |
| 20 | +import org.junit.Test; |
| 21 | +import spoon.Launcher; |
| 22 | +import spoon.processing.processors.MyProcessor; |
| 23 | + |
| 24 | +import static org.junit.Assert.assertFalse; |
| 25 | +import static org.junit.Assert.fail; |
| 26 | + |
| 27 | +public class ProcessingTest { |
| 28 | + @Test |
| 29 | + public void testInterruptAProcessor() throws Exception { |
| 30 | + final Launcher launcher = new Launcher(); |
| 31 | + launcher.getEnvironment().setNoClasspath(true); |
| 32 | + launcher.addInputResource("./src/tets/java/spoon/processing/"); |
| 33 | + launcher.setSourceOutputDirectory("./target/trash"); |
| 34 | + final MyProcessor processor = new MyProcessor(); |
| 35 | + launcher.addProcessor(processor); |
| 36 | + try { |
| 37 | + launcher.run(); |
| 38 | + } catch (ProcessInterruption e) { |
| 39 | + fail("ProcessInterrupt exception must be catch in the ProcessingManager."); |
| 40 | + } |
| 41 | + assertFalse(processor.isShouldStayAtFalse()); |
| 42 | + } |
| 43 | +} |
0 commit comments