diff options
Diffstat (limited to 'tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorTest.java')
-rw-r--r-- | tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorTest.java | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorTest.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorTest.java new file mode 100644 index 00000000000..062f5e0ebbe --- /dev/null +++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorTest.java @@ -0,0 +1,58 @@ +/***************************************************************************** + * Copyright (c) 2016 Christian W. Damus 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.eclipse.project.editors.tests; + +import static org.hamcrest.CoreMatchers.hasItem; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.assertThat; + +import java.util.List; + +import org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor; +import org.junit.Rule; +import org.junit.Test; + +/** + * Test cases for the implementation of the {@link IProjectEditor} API. + */ +public class ProjectEditorTest { + + @Rule + public final ProjectEditorFixture<? extends IProjectEditor> fixture; + + public ProjectEditorTest() { + this(new ProjectEditorFixture<>(IProjectEditor.class)); + } + + ProjectEditorTest(ProjectEditorFixture<? extends IProjectEditor> fixture) { + super(); + + this.fixture = fixture; + } + + @Test + @MissingFiles + public void getMissingFiles() { + // The .project file already exists (cannot be avoided) + assertThat(fixture.getEditor().getMissingFiles(), not(hasItem(".project"))); + } + + @Test + public void addFile() { + fixture.getEditor().addFile(fixture.getResource("simple_project/hello.txt"), "hello.txt", true); + List<String> lines = fixture.slurp("hello.txt"); + assertThat(lines, hasItem("Hello, world!")); + } + +} |