diff options
author | Sopot Cela | 2016-02-03 13:21:03 +0000 |
---|---|---|
committer | Sopot Cela | 2016-02-03 13:21:03 +0000 |
commit | 4e7aa5c62f126bb1ab1f6a4a527176bb2debd450 (patch) | |
tree | 3d5e5f44b349f4e7c914a2f81297c69f9a610cb2 /org.eclipse.core.filebuffers.tests | |
parent | fdfe9878fed51da5cf72454dea079a13b139d607 (diff) | |
download | eclipse.platform.text-4e7aa5c62f126bb1ab1f6a4a527176bb2debd450.tar.gz eclipse.platform.text-4e7aa5c62f126bb1ab1f6a4a527176bb2debd450.tar.xz eclipse.platform.text-4e7aa5c62f126bb1ab1f6a4a527176bb2debd450.zip |
Bug 487095 - Move test bundles to JUnit 4
Change-Id: I6fe94aa5772223bd49414f603d9d52c24c7ac891
Signed-off-by: Sopot Cela <scela@redhat.com>
Diffstat (limited to 'org.eclipse.core.filebuffers.tests')
18 files changed, 247 insertions, 71 deletions
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java index ee6cb0fd44b..b9ff36ab681 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java @@ -10,10 +10,14 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertEquals; + import java.util.Arrays; import java.util.HashSet; import java.util.Set; +import org.junit.Test; + import org.eclipse.core.runtime.Path; import org.eclipse.core.filebuffers.IDocumentSetupParticipantExtension; @@ -28,40 +32,44 @@ import org.eclipse.core.filebuffers.tests.MockDocumentSetupParticipants.TestDSP6 import org.eclipse.jface.text.IDocument; -import junit.framework.TestCase; - /** * @since 3.4 */ -public abstract class AbstractFileBufferDocCreationTests extends TestCase { +public abstract class AbstractFileBufferDocCreationTests { protected ITextFileBufferManager fManager; - + @Test public void testCreateDocumentPartipants_FileExt() { assertParticipantsInvoked("anything.111foo", new Class[] {TestDSP1.class, TestDSP3.class}); } - + + @Test public void testCreateDocumentPartipants_Name() { assertParticipantsInvoked("111fooname", new Class[] {TestDSP2.class, TestDSP3.class}); } + @Test public void testCreateDocumentPartipants_FileExt_Name() { assertParticipantsInvoked("111fooname.111foo", new Class[] {TestDSP1.class, TestDSP2.class, TestDSP3.class}); } + @Test public void testCreateDocumentPartipants_FileExt_Extension() { assertParticipantsInvoked("anything.222foo", new Class[] {TestDSP4.class, TestDSP6.class}); } + @Test public void testCreateDocumentPartipants_Name_Extension() { assertParticipantsInvoked("222fooname", new Class[] {TestDSP5.class, TestDSP6.class}); } + @Test public void testCreateDocumentPartipants_FileExt_Name_Extension() { assertParticipantsInvoked("222fooname.222foo", new Class[] {TestDSP4.class, TestDSP5.class, TestDSP6.class}); } + @Test public void testDocumentSetupParticipantExtension_1() { assertDocumentContent("emanoof333/p/", "/p/333fooname", LocationKind.IFILE); assertDocumentContent("oof333.emanoof333/p/", "/p/333fooname.333foo", LocationKind.IFILE); @@ -76,6 +84,7 @@ public abstract class AbstractFileBufferDocCreationTests extends TestCase { assertDocumentContent("", "anything.333foo", LocationKind.NORMALIZE); } + @Test public void testDocumentSetupParticipantExtension_2() { assertDocumentContent("", "/p/444fooname", LocationKind.IFILE); assertDocumentContent("", "/p/444fooname.444foo", LocationKind.IFILE); @@ -90,6 +99,7 @@ public abstract class AbstractFileBufferDocCreationTests extends TestCase { assertDocumentContent("", "anything.444foo", LocationKind.NORMALIZE); } + @Test public void testDocumentSetupParticipantExtension_3() { assertDocumentContent("", "/p/555fooname", LocationKind.IFILE); assertDocumentContent("", "/p/555fooname.555foo", LocationKind.IFILE); diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java index eb8667b1032..7c0bc37b52f 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java @@ -10,11 +10,19 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; -import java.io.File; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; -import junit.framework.TestCase; +import java.io.File; +import org.junit.After; import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileStore; @@ -38,7 +46,7 @@ import org.eclipse.jface.text.IDocument; -public class FileBufferCreation extends TestCase { +public class FileBufferCreation { private final static String CONTENT1= "This is the content of the workspace file."; private final static String CONTENT2= "This is the content of the link target."; @@ -49,17 +57,13 @@ public class FileBufferCreation extends TestCase { private IProject fProject; - public FileBufferCreation(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { + @Before + public void setUp() throws Exception { fProject= ResourceHelper.createProject("project"); } - @Override - protected void tearDown() throws Exception { + @After + public void tearDown() throws Exception { ResourceHelper.deleteProject("project"); } @@ -76,6 +80,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of file buffer for an existing file. */ + @Test public void test1() throws Exception { IFolder folder= ResourceHelper.createFolder("project/folderA/folderB/"); IFile file= ResourceHelper.createFile(folder, "file", CONTENT1); @@ -100,6 +105,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of file buffer for an existing file. */ + @Test public void test1_IFileStore() throws Exception { IFolder folder= ResourceHelper.createFolder("project/folderA/folderB/"); IFile file= ResourceHelper.createFile(folder, "file", CONTENT1); @@ -126,6 +132,7 @@ public class FileBufferCreation extends TestCase { * Tests that two different paths pointing to the same physical resource * result in the same shared file buffer. */ + @Test public void test2() throws Exception { IFolder folder= ResourceHelper.createFolder("project/folderA/folderB/"); @@ -178,6 +185,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of a file buffer for a linked file. */ + @Test public void test3_1() throws Exception { IPath path= createLinkedFile("file", "testResources/LinkedFileTarget"); assertNotNull(path); @@ -199,6 +207,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of a file buffer for a file in a linked folder. */ + @Test public void test3_2() throws Exception { IPath path= createLinkedFolder("linkedFolder", "testResources/linkedFolderTarget"); assertNotNull(path); @@ -222,6 +231,7 @@ public class FileBufferCreation extends TestCase { * Tests that two different files linked to the same target file result * in two different, independent file buffers. */ + @Test public void test4() throws Exception { IPath path1= createLinkedFile("file1", "testResources/LinkedFileTarget"); @@ -266,6 +276,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of a file buffer for an external file. */ + @Test public void test5() throws Exception { File externalFile= FileTool.getFileInPlugin(FileBuffersTestPlugin.getDefault(), new Path("testResources/ExternalFile")); assertNotNull(externalFile); @@ -289,6 +300,7 @@ public class FileBufferCreation extends TestCase { * Tests that a workspace file linked to an external file and the external file result * in two different, independent file buffers. */ + @Test public void test6() throws Exception { IPath path1= createLinkedFile("file1", "testResources/ExternalFile"); @@ -334,6 +346,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of a file buffer for a non-existing file. */ + @Test public void test7() throws Exception { IPath path= FileBuffersTestPlugin.getDefault().getStateLocation(); path= path.append("NonExistingFile"); @@ -355,6 +368,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of file buffer for an existing file. */ + @Test public void test1_IFILE() throws Exception { IFolder folder= ResourceHelper.createFolder("project/folderA/folderB/"); IFile file= ResourceHelper.createFile(folder, "file", CONTENT1); @@ -380,6 +394,7 @@ public class FileBufferCreation extends TestCase { * Tests that two different paths pointing to the same physical resource * result in the same shared file buffer. */ + @Test public void test2_new() throws Exception { IFolder folder= ResourceHelper.createFolder("project/folderA/folderB/"); @@ -432,6 +447,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of a file buffer for a linked file. */ + @Test public void test3_1_IFILE() throws Exception { IPath path= createLinkedFile("file", "testResources/LinkedFileTarget"); assertNotNull(path); @@ -453,6 +469,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of a file buffer for a file in a linked folder. */ + @Test public void test3_2_new() throws Exception { IPath path= createLinkedFolder("linkedFolder", "testResources/linkedFolderTarget"); assertNotNull(path); @@ -476,6 +493,7 @@ public class FileBufferCreation extends TestCase { * Tests that two different files linked to the same target file result * in two different, independent file buffers. */ + @Test public void test4_IFILE() throws Exception { IPath path1= createLinkedFile("file1", "testResources/LinkedFileTarget"); @@ -520,6 +538,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of a file buffer for an external file. */ + @Test public void test5_location() throws Exception { File externalFile= FileTool.getFileInPlugin(FileBuffersTestPlugin.getDefault(), new Path("testResources/ExternalFile")); assertNotNull(externalFile); @@ -542,6 +561,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of a file buffer for a non-existing file. */ + @Test public void test7_location() throws Exception { IPath path= FileBuffersTestPlugin.getDefault().getStateLocation(); path= path.append("NonExistingFile"); @@ -563,6 +583,7 @@ public class FileBufferCreation extends TestCase { /* * Tests the creation of a file buffer for a non-existing file. */ + @Test public void test7_IFileStore() throws Exception { IPath path= FileBuffersTestPlugin.getDefault().getStateLocation(); path= path.append("NonExistingFile"); diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java index 3881085b50a..e6ba71ea777 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java @@ -11,9 +11,20 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.PrintStream; import java.io.PrintWriter; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.IFileStore; @@ -33,12 +44,10 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentExtension4; import org.eclipse.jface.text.source.IAnnotationModel; -import junit.framework.TestCase; - /** * FileBufferFunctions */ -public abstract class FileBufferFunctions extends TestCase { +public abstract class FileBufferFunctions { private IProject fProject; protected ITextFileBufferManager fManager; @@ -60,8 +69,8 @@ public abstract class FileBufferFunctions extends TestCase { protected abstract Class<IAnnotationModel> getAnnotationModelClass() throws Exception; - @Override - protected void setUp() throws Exception { + @Before + public void setUp() throws Exception { fManager= FileBuffers.getTextFileBufferManager(); fProject= ResourceHelper.createProject("project"); fPath= createPath(fProject); @@ -73,8 +82,8 @@ public abstract class FileBufferFunctions extends TestCase { return fProject; } - @Override - protected void tearDown() throws Exception { + @After + public void tearDown() { ITextFileBuffer buffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE); assertTrue(buffer == null); ResourceHelper.deleteProject("project"); @@ -87,6 +96,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Tests getLocation. */ + @Test public void test1() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -101,6 +111,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Tests isSynchronized. */ + @Test public void test2() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -122,6 +133,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Tests isDirty. */ + @Test public void test3() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -139,6 +151,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Tests isShared. */ + @Test public void test4() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -164,6 +177,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Tests getModificationStamp. */ + @Test public void test5() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -185,6 +199,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test revert. */ + @Test public void test6() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -215,6 +230,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test commit. */ + @Test public void test7() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -259,6 +275,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test validateState. */ + @Test public void test8_1() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -275,6 +292,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test validateState. */ + @Test public void test8_2() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -293,6 +311,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test resetStateValidation. */ + @Test public void test9_1() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -311,6 +330,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test resetStateValidation. */ + @Test public void test9_2() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -331,6 +351,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#bufferCreated and IFileBufferListener#bufferDisposed */ + @Test public void test10() throws Exception { class Listener extends FileBufferListener { @@ -377,6 +398,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#dirtyStateChanged */ + @Test public void test11_1() throws Exception { class Listener extends FileBufferListener { @@ -428,6 +450,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#dirtyStateChanged */ + @Test public void test11_2() throws Exception { class Listener extends FileBufferListener { @@ -478,6 +501,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#bufferContentAboutToBeReplaced/replaced */ + @Test public void test12_1() throws Exception { class Listener extends FileBufferListener { @@ -529,6 +553,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#bufferContentAboutToBeReplaced/replaced */ + @Test public void test12_2() throws Exception { class Listener extends FileBufferListener { @@ -578,6 +603,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateValidationChanged */ + @Test public void test13_1() throws Exception { class Listener extends FileBufferListener { @@ -623,6 +649,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateValidationChanged */ + @Test public void test13_2() throws Exception { class Listener extends FileBufferListener { @@ -669,6 +696,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateValidationChanged */ + @Test public void test13_3() throws Exception { class Listener extends FileBufferListener { @@ -715,6 +743,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateValidationChanged */ + @Test public void test13_4() throws Exception { class Listener extends FileBufferListener { @@ -763,6 +792,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#underlyingFileDeleted */ + @Test public void test14() throws Exception { class Listener extends FileBufferListener { @@ -803,6 +833,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#underlyingFileMoved */ + @Test public void test15() throws Exception { class Listener extends FileBufferListener { @@ -857,6 +888,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for external changes */ + @Test public void test16_1() throws Exception { class Listener extends FileBufferListener { @@ -897,6 +929,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for external changes */ + @Test public void test16_2() throws Exception { class Listener extends FileBufferListener { @@ -937,6 +970,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for external changes */ + @Test public void test16_3() throws Exception { class Listener extends FileBufferListener { @@ -977,6 +1011,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for internal changes */ + @Test public void test17_1() throws Exception { class Listener extends FileBufferListener { @@ -1018,6 +1053,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for internal changes */ + @Test public void test17_2() throws Exception { class Listener extends FileBufferListener { @@ -1060,6 +1096,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for internal changes */ + @Test public void test17_3() throws Exception { class Listener extends FileBufferListener { @@ -1103,6 +1140,7 @@ public abstract class FileBufferFunctions extends TestCase { * Test annotation model existence. * ATTENTION: This test is only effective in a workspace that contains the "org.eclipse.ui.editors" bundle. */ + @Test public void test18() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -1123,6 +1161,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Test notification in case of failing listener. */ + @Test public void test19() throws Exception { class NotifiedListener extends FileBufferListener { @@ -1192,7 +1231,8 @@ public abstract class FileBufferFunctions extends TestCase { assertEquals(2, notifyCounter1.notifyCount); assertEquals(2, notifyCounter2.notifyCount); } - + + @Test public void testGetBufferForDocument() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { @@ -1209,6 +1249,7 @@ public abstract class FileBufferFunctions extends TestCase { /* * Tests isSynchronized. */ + @Test public void testGetFileStoreAnnotationModel() throws Exception { IFileStore fileStore= EFS.getNullFileSystem().getStore(new Path("/dev/null")); assertNotNull(fileStore); @@ -1226,6 +1267,7 @@ public abstract class FileBufferFunctions extends TestCase { } } + @Test public void testGetFileBuffers() throws Exception { fManager.connect(fPath, LocationKind.NORMALIZE, null); try { diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java index b5840cbc3c5..989291d36fb 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java @@ -10,8 +10,12 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertNotNull; + import java.io.File; +import org.junit.After; + import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileStore; @@ -30,7 +34,8 @@ import org.eclipse.jface.text.source.IAnnotationModel; public class FileBuffersForExternalFiles extends FileBufferFunctions { @Override - protected void tearDown() throws Exception { + @After + public void tearDown() { FileTool.delete(getPath()); FileTool.delete(FileBuffers.getSystemFileAtLocation(getPath()).getParentFile()); super.tearDown(); diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java index add40638ef3..12a69eec6f0 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java @@ -10,10 +10,14 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.File; import java.io.IOException; import java.io.OutputStream; +import org.junit.After; import org.osgi.framework.Bundle; import org.eclipse.core.filesystem.EFS; @@ -42,7 +46,8 @@ public class FileBuffersForFilesInLinkedFolders extends FileBufferFunctions { private File fExternalFile; @Override - protected void tearDown() throws Exception { + @After + public void tearDown() { FileTool.delete(getPath()); File file= fExternalFile; FileTool.delete(file); // externalResources/linkedFolderTarget/FileInLinkedFolder diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java index 6977a6b4712..a9b5778dde8 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java @@ -12,6 +12,7 @@ package org.eclipse.core.filebuffers.tests; import java.io.File; +import org.junit.After; import org.osgi.framework.Bundle; import org.eclipse.core.runtime.IPath; @@ -35,7 +36,8 @@ public class FileBuffersForLinkedFiles extends FileBufferFunctions { private File fExternalFile; @Override - protected void tearDown() throws Exception { + @After + public void tearDown() { FileTool.delete(fExternalFile); FileTool.delete(fExternalFile.getParentFile()); super.tearDown(); diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java index d4c1a9f1ca4..badf7eeb803 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java @@ -10,6 +10,12 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertNotNull; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileStore; @@ -29,7 +35,8 @@ import org.eclipse.jface.text.source.IAnnotationModel; public class FileBuffersForNonAccessibleWorkspaceFiles extends FileBufferFunctions { @Override - protected void setUp() throws Exception { + @Before + public void setUp() throws Exception { super.setUp(); getProject().close(null); } @@ -43,7 +50,8 @@ public class FileBuffersForNonAccessibleWorkspaceFiles extends FileBufferFunctio @Override - protected void tearDown() throws Exception { + @After + public void tearDown() { FileTool.delete(getPath()); super.tearDown(); } @@ -84,16 +92,19 @@ public class FileBuffersForNonAccessibleWorkspaceFiles extends FileBufferFunctio } @Override + @Test public void test7() throws Exception { // disable because it might create a file outside the closed project } @Override + @Test public void test11_1() throws Exception { // disable because it might create a file outside the closed project } @Override + @Test public void test17_3() throws Exception { // disable because it might create a file outside the closed project } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java index e070b56e215..e9e942582d3 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java @@ -10,6 +10,10 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertNotNull; + +import org.junit.After; + import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileStore; @@ -28,7 +32,8 @@ import org.eclipse.jface.text.source.IAnnotationModel; public class FileBuffersForNonExistingExternalFiles extends FileBufferFunctions { @Override - protected void tearDown() throws Exception { + @After + public void tearDown() { FileTool.delete(getPath()); super.tearDown(); } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java index 3484b862d08..fb37c67c122 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java @@ -10,6 +10,13 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.Test; + import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileStore; @@ -31,7 +38,8 @@ import org.eclipse.jface.text.source.IAnnotationModel; public class FileBuffersForNonExistingWorkspaceFiles extends FileBufferFunctions { @Override - protected void tearDown() throws Exception { + @After + public void tearDown() { FileTool.delete(getPath()); super.tearDown(); } @@ -42,7 +50,8 @@ public class FileBuffersForNonExistingWorkspaceFiles extends FileBufferFunctions IPath filePath= folder.getLocation().append("NonExistingWorkspaceFile"); return filePath.makeAbsolute(); } - + + @Test public void testBug118199() throws Exception { IFile file= getProject().getWorkspace().getRoot().getFile(getPath()); assertFalse(file.exists()); @@ -57,6 +66,7 @@ public class FileBuffersForNonExistingWorkspaceFiles extends FileBufferFunctions assertFalse(file.exists()); } + @Test public void testBug118199_fixed() throws Exception { IFile file= getProject().getWorkspace().getRoot().getFileForLocation(getPath()); IPath path= file.getFullPath(); diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java index d4627276b33..8b0c362c96c 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.IOException; import java.io.OutputStream; diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java index 00a0c6c9242..b3f3331440e 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java @@ -12,8 +12,9 @@ package org.eclipse.core.filebuffers.tests; -import junit.framework.Test; -import junit.framework.TestSuite; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; /** @@ -21,28 +22,22 @@ import junit.framework.TestSuite; * * @since 3.0 */ +@RunWith(Suite.class) +@SuiteClasses({FileBufferCreation.class, + FileBuffersForWorkspaceFiles.class, + FileBuffersForExternalFiles.class, + FileBuffersForLinkedFiles.class, + FileBuffersForFilesInLinkedFolders.class, + FileBuffersForNonExistingExternalFiles.class, + FileBuffersForNonExistingWorkspaceFiles.class, + FileBuffersForNonAccessibleWorkspaceFiles.class, + FileStoreFileBuffersForWorkspaceFiles.class, + FileStoreFileBuffersForExternalFiles.class, + FileStoreFileBuffersForNonExistingExternalFiles.class, + FileStoreFileBuffersForNonExistingWorkspaceFiles.class, + TextFileManagerDocCreationTests.class, + ResourceTextFileManagerDocCreationTests.class + }) public class FileBuffersTestSuite { - - public static Test suite() { - TestSuite suite= new TestSuite("Test Suite for org.eclipse.core.filebuffers"); //$NON-NLS-1$ - //$JUnit-BEGIN$ - suite.addTestSuite(FileBufferCreation.class); - suite.addTestSuite(FileBuffersForWorkspaceFiles.class); - suite.addTestSuite(FileBuffersForExternalFiles.class); - suite.addTestSuite(FileBuffersForLinkedFiles.class); - suite.addTestSuite(FileBuffersForFilesInLinkedFolders.class); - suite.addTestSuite(FileBuffersForNonExistingExternalFiles.class); - suite.addTestSuite(FileBuffersForNonExistingWorkspaceFiles.class); - suite.addTestSuite(FileBuffersForNonAccessibleWorkspaceFiles.class); - - suite.addTestSuite(FileStoreFileBuffersForWorkspaceFiles.class); - suite.addTestSuite(FileStoreFileBuffersForExternalFiles.class); - suite.addTestSuite(FileStoreFileBuffersForNonExistingExternalFiles.class); - suite.addTestSuite(FileStoreFileBuffersForNonExistingWorkspaceFiles.class); - - suite.addTestSuite(TextFileManagerDocCreationTests.class); - suite.addTestSuite(ResourceTextFileManagerDocCreationTests.class); - //$JUnit-END$ - return suite; - } + //intentionally left empty } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java index b6d985fea9e..fbf3d8c522b 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java @@ -10,9 +10,19 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + import java.io.PrintStream; import java.io.PrintWriter; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.IFileStore; @@ -31,12 +41,11 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentExtension4; import org.eclipse.jface.text.source.IAnnotationModel; -import junit.framework.TestCase; /** * FileBufferFunctions */ -public abstract class FileStoreFileBufferFunctions extends TestCase { +public abstract class FileStoreFileBufferFunctions { private IProject fProject; protected ITextFileBufferManager fManager; @@ -57,9 +66,8 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { protected abstract Class<IAnnotationModel> getAnnotationModelClass() throws Exception; - - @Override - protected void setUp() throws Exception { + @Before + public void setUp() throws Exception { fManager= FileBuffers.getTextFileBufferManager(); fProject= ResourceHelper.createProject("project"); fFileStore= EFS.getLocalFileSystem().getStore(createPath(fProject)); @@ -71,8 +79,8 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { return fProject; } - @Override - protected void tearDown() throws Exception { + @After + public void tearDown() { ITextFileBuffer buffer= fManager.getFileStoreTextFileBuffer(fFileStore); assertTrue(buffer == null); ResourceHelper.deleteProject("project"); @@ -85,6 +93,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Tests getLocation. */ + @Test public void test1() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -99,6 +108,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Tests isSynchronized. */ + @Test public void test2() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -120,6 +130,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Tests isDirty. */ + @Test public void test3() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -137,6 +148,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Tests isShared. */ + @Test public void test4() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -162,6 +174,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Tests getModificationStamp. */ + @Test public void test5() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -182,6 +195,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test revert. */ + @Test public void test6() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -211,6 +225,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test commit. */ + @Test public void test7() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -255,6 +270,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test validateState. */ + @Test public void test8_1() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -271,6 +287,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test validateState. */ + @Test public void test8_2() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -289,6 +306,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test resetStateValidation. */ + @Test public void test9_1() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -307,6 +325,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test resetStateValidation. */ + @Test public void test9_2() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -327,6 +346,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#bufferCreated and IFileBufferListener#bufferDisposed */ + @Test public void test10() throws Exception { class Listener extends FileBufferListener { @@ -373,6 +393,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#dirtyStateChanged */ + @Test public void test11_1() throws Exception { class Listener extends FileBufferListener { @@ -424,6 +445,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#dirtyStateChanged */ + @Test public void test11_2() throws Exception { class Listener extends FileBufferListener { @@ -474,6 +496,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#bufferContentAboutToBeReplaced/replaced */ + @Test public void test12_1() throws Exception { class Listener extends FileBufferListener { @@ -525,6 +548,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#bufferContentAboutToBeReplaced/replaced */ + @Test public void test12_2() throws Exception { class Listener extends FileBufferListener { @@ -574,6 +598,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateValidationChanged */ + @Test public void test13_1() throws Exception { class Listener extends FileBufferListener { @@ -619,6 +644,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateValidationChanged */ + @Test public void test13_2() throws Exception { class Listener extends FileBufferListener { @@ -665,6 +691,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateValidationChanged */ + @Test public void test13_3() throws Exception { class Listener extends FileBufferListener { @@ -711,6 +738,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateValidationChanged */ + @Test public void test13_4() throws Exception { class Listener extends FileBufferListener { @@ -759,6 +787,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#underlyingFileDeleted */ + @Test public void test14() throws Exception { class Listener extends FileBufferListener { @@ -799,6 +828,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#underlyingFileMoved */ + @Test public void test15() throws Exception { class Listener extends FileBufferListener { @@ -843,6 +873,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for external changes */ + @Test public void test16_1() throws Exception { class Listener extends FileBufferListener { @@ -883,6 +914,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for external changes */ + @Test public void test16_2() throws Exception { class Listener extends FileBufferListener { @@ -923,6 +955,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for external changes */ + @Test public void test16_3() throws Exception { class Listener extends FileBufferListener { @@ -963,6 +996,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for internal changes */ + @Test public void test17_1() throws Exception { class Listener extends FileBufferListener { @@ -1004,6 +1038,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for internal changes */ + @Test public void test17_2() throws Exception { class Listener extends FileBufferListener { @@ -1046,6 +1081,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test IFileBufferListener#stateChanging for internal changes */ + @Test public void test17_3() throws Exception { class Listener extends FileBufferListener { @@ -1089,6 +1125,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { * Test annotation model existence. * ATTENTION: This test is only effective in a workspace that contains the "org.eclipse.ui.editors" bundle. */ + @Test public void test18() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -1109,6 +1146,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { /* * Test notification in case of failing listener. */ + @Test public void test19() throws Exception { class NotifiedListener extends FileBufferListener { @@ -1179,6 +1217,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { assertEquals(2, notifyCounter2.notifyCount); } + @Test public void testGetBufferForDocument() throws Exception { fManager.connectFileStore(fFileStore, null); try { @@ -1192,6 +1231,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase { } } + @Test public void testGetFileStoreFileBuffers() throws Exception { fManager.connectFileStore(fFileStore, null); try { diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java index de02b912946..0a45cc354c1 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java @@ -10,8 +10,12 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertNotNull; + import java.io.File; +import org.junit.After; + import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileStore; @@ -30,7 +34,8 @@ import org.eclipse.jface.text.source.IAnnotationModel; public class FileStoreFileBuffersForExternalFiles extends FileStoreFileBufferFunctions { @Override - protected void tearDown() throws Exception { + @After + public void tearDown() { FileTool.delete(getPath()); FileTool.delete(FileBuffers.getSystemFileAtLocation(getPath()).getParentFile()); super.tearDown(); diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java index ad1f6c91de9..531bbe1f01c 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java @@ -10,6 +10,10 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertNotNull; + +import org.junit.After; + import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileStore; @@ -28,7 +32,8 @@ import org.eclipse.jface.text.source.IAnnotationModel; public class FileStoreFileBuffersForNonExistingExternalFiles extends FileStoreFileBufferFunctions { @Override - protected void tearDown() throws Exception { + @After + public void tearDown() { FileTool.delete(getPath()); super.tearDown(); } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java index 2da4f6f1bb5..235b8f55b5a 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java @@ -10,6 +10,11 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Test; + import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileStore; @@ -31,7 +36,8 @@ import org.eclipse.jface.text.source.IAnnotationModel; public class FileStoreFileBuffersForNonExistingWorkspaceFiles extends FileStoreFileBufferFunctions { @Override - protected void tearDown() throws Exception { + @After + public void tearDown() { FileTool.delete(getPath()); super.tearDown(); } @@ -43,6 +49,7 @@ public class FileStoreFileBuffersForNonExistingWorkspaceFiles extends FileStoreF return filePath.makeAbsolute(); } + @Test public void testBug118199() throws Exception { IFile file= getProject().getWorkspace().getRoot().getFile(getPath()); assertFalse(file.exists()); @@ -57,6 +64,7 @@ public class FileStoreFileBuffersForNonExistingWorkspaceFiles extends FileStoreF assertFalse(file.exists()); } + @Test public void testBug118199_fixed() throws Exception { IFile file= getProject().getWorkspace().getRoot().getFileForLocation(getPath()); IPath path= file.getFullPath(); diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java index dcf49abe98f..79ed473833c 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.IOException; import java.io.OutputStream; diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceTextFileManagerDocCreationTests.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceTextFileManagerDocCreationTests.java index ae2a30f8377..f1835830dbe 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceTextFileManagerDocCreationTests.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceTextFileManagerDocCreationTests.java @@ -10,6 +10,10 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import static org.junit.Assert.assertEquals; + +import org.junit.Before; + import org.eclipse.core.internal.filebuffers.ResourceTextFileBufferManager; import org.eclipse.core.runtime.Path; @@ -25,8 +29,8 @@ import org.eclipse.core.filebuffers.LocationKind; */ public class ResourceTextFileManagerDocCreationTests extends AbstractFileBufferDocCreationTests { - @Override - protected void setUp() throws Exception { + @Before + public void setUp() { fManager= new ResourceTextFileBufferManager(); } diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/TextFileManagerDocCreationTests.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/TextFileManagerDocCreationTests.java index c4c295e5167..5130d030f8b 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/TextFileManagerDocCreationTests.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/TextFileManagerDocCreationTests.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.core.filebuffers.tests; +import org.junit.Before; + import org.eclipse.core.internal.filebuffers.TextFileBufferManager; import org.eclipse.core.filebuffers.LocationKind; @@ -20,8 +22,8 @@ import org.eclipse.core.filebuffers.LocationKind; */ public class TextFileManagerDocCreationTests extends AbstractFileBufferDocCreationTests { - @Override - protected void setUp() throws Exception { + @Before + public void setUp() { fManager= new TextFileBufferManager(); } |