blob: 062f5e0ebbeccd5b512f901760f7f180506e8435 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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!"));
}
}
|