diff options
Diffstat (limited to 'org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/InvalidTest.java')
-rw-r--r-- | org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/InvalidTest.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/InvalidTest.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/InvalidTest.java new file mode 100644 index 000000000..313a3ae9a --- /dev/null +++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/InvalidTest.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2000, 2005 IBM Corporation and others. + * 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ua.tests.cheatsheet.parser; + +import java.net.URL; + +import junit.framework.Assert; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin; +import org.eclipse.ua.tests.util.ResourceFinder; +import org.eclipse.ui.internal.cheatsheets.data.CheatSheet; +import org.eclipse.ui.internal.cheatsheets.data.CheatSheetParser; + +/* + * Tests the cheat sheets parser on invalid cheat sheets. + */ +public class InvalidTest extends TestCase { + + /* + * Returns an instance of this Test. + */ + public static Test suite() { + return new TestSuite(InvalidTest.class); + } + + /* + * Test all invalid cheat sheets. + */ + public void testParserInvalid() { + URL[] urls = ResourceFinder.findFiles(UserAssistanceTestPlugin.getDefault(), "data/cheatsheet/invalid", ".xml", true); + Assert.assertTrue("Unable to find sample cheat sheets to test parser", urls.length > 0); + for (int i=0;i<urls.length;++i) { + CheatSheetParser parser = new CheatSheetParser(); + CheatSheet sheet = parser.parse(urls[i]); + Assert.assertNull("Tried parsing an invalid rational cheat sheet but parser did not return null: " + urls[i], sheet); + } + } +} |