Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.ltk.core.refactoring.tests
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ltk.core.refactoring.tests; singleton:=true
Bundle-Version: 3.10.700.qualifier
Bundle-Version: 3.10.800.qualifier
Bundle-Activator: org.eclipse.ltk.core.refactoring.tests.RefactoringCoreTestPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.participants;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILogListener;
Expand Down Expand Up @@ -131,14 +131,14 @@ public RefactoringParticipant[] loadParticipants(RefactoringStatus status, Shara
private ILogListener fLogListener;
private List<IStatus> fLogEntries;

@Before
@BeforeEach
public void setUp() {
fLogListener= (status, plugin) -> fLogEntries.add(status);
Platform.addLogListener(fLogListener);
fLogEntries= new ArrayList<>();
}

@After
@AfterEach
public void tearDown() throws Exception {
Platform.removeLogListener(fLogListener);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.participants;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.core.tests.harness.FussyProgressMonitor;

Expand All @@ -44,13 +44,13 @@ public class FailingParticipantTests {
private ILogListener fLogListener;
private List<IStatus> fLogEntries;

@Before
@BeforeEach
public void setUp() {
fLogListener= (status, plugin) -> fLogEntries.add(status);
Platform.addLogListener(fLogListener);
}

@After
@AfterEach
public void tearDown() throws Exception {
Platform.removeLogListener(fLogListener);
}
Expand Down Expand Up @@ -84,8 +84,8 @@ public void testFailingParticipants() throws Exception {

assertEquals(1, fLogEntries.size());
IStatus status= fLogEntries.get(0);
assertEquals("Exception wrong", status.getException().getClass(), FailingParticipant.Exception.class);
assertTrue("No exception generated", exception);
assertEquals(FailingParticipant.Exception.class, status.getException().getClass(), "Exception wrong");
assertTrue(exception, "No exception generated");

resetLog();

Expand Down Expand Up @@ -113,8 +113,8 @@ public void testFailingParticipants() throws Exception {

assertEquals(1, fLogEntries.size());
status= fLogEntries.get(0);
assertEquals("Exception wrong", status.getException().getClass(), FailingParticipant2.Exception.class);
assertTrue("No exception generated", exception);
assertEquals(FailingParticipant2.Exception.class, status.getException().getClass(), "Exception wrong");
assertTrue(exception, "No exception generated");

resetLog();

Expand All @@ -136,7 +136,7 @@ public void testFailingParticipants() throws Exception {
pm.prepare();

assertEquals(0, fLogEntries.size());
assertTrue("Working participant not executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC));
assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC), "Working participant not executed");
}

// If the main refactoring fails to execute, disable any participants contributing preChanges
Expand Down Expand Up @@ -167,21 +167,21 @@ public void testFailingRefactorWithPreParticipants() throws Exception {
//System.out.println(fLogEntries);
assertEquals(2, fLogEntries.size());
IStatus status= fLogEntries.get(0);
assertEquals("Exception wrong", status.getException().getClass(), RuntimeException.class);
assertEquals("Status code wrong", IRefactoringCoreStatusCodes.REFACTORING_EXCEPTION_DISABLED_PARTICIPANTS, status.getCode());
assertEquals(RuntimeException.class, status.getException().getClass(), "Exception wrong");
assertEquals(IRefactoringCoreStatusCodes.REFACTORING_EXCEPTION_DISABLED_PARTICIPANTS, status.getCode(), "Status code wrong");
status= fLogEntries.get(1);
assertNull("Exception wrong", status.getException());
assertEquals("Status code wrong", IRefactoringCoreStatusCodes.PARTICIPANT_DISABLED, status.getCode());
assertTrue("No exception generated", exception);
assertNull(status.getException(), "Exception wrong");
assertEquals(IRefactoringCoreStatusCodes.PARTICIPANT_DISABLED, status.getCode(), "Status code wrong");
assertTrue(exception, "No exception generated");

//System.out.println(ElementRenameProcessor.fHistory);

assertTrue("Working participant not created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE));
assertFalse("Working participant executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC));
assertTrue("Working participant pre not created pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE));
assertTrue("Working participant pre not created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE));
assertTrue("Working participant pre not executed pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE));
assertFalse("Working participant pre executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC));
assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE), "Working participant not created");
assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC), "Working participant executed");
assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE), "Working participant pre not created pre");
assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE), "Working participant pre not created");
assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE), "Working participant pre not executed pre");
assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC), "Working participant pre executed");


// Now try it again and the working participant should not be called at all,
Expand All @@ -197,12 +197,12 @@ public void testFailingRefactorWithPreParticipants() throws Exception {

assertEquals(0, fLogEntries.size());

assertTrue("Working participant not created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE));
assertTrue("Working participant not executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC));
assertFalse("Working participant pre created pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE));
assertFalse("Working participant pre created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE));
assertFalse("Working participant pre executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC));
assertFalse("Working participant pre executed pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE));
assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE), "Working participant not created");
assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC), "Working participant not executed");
assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE), "Working participant pre created pre");
assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE), "Working participant pre created");
assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC), "Working participant pre executed");
assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE), "Working participant pre executed pre");

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.participants;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
Expand Down Expand Up @@ -196,12 +196,12 @@ private void getModifiedFiles(List<IFile> result, Change[] changes) {
}
}

@Before
@BeforeEach
public void setUp() throws Exception {
fProject= new SimpleTestProject();
}

@After
@AfterEach
public void tearDown() throws Exception {
fProject.delete();
}
Expand All @@ -218,10 +218,10 @@ public void testMoveRefactoringWithParticipants() throws Exception {
PerformRefactoringOperation op= new PerformRefactoringOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
ResourcesPlugin.getWorkspace().run(op, null);

assertTrue("File is not moved", this.fProject.getProject().getFolder("dest").getFile("fileToMove.txt").exists());
assertTrue(this.fProject.getProject().getFolder("dest").getFile("fileToMove.txt").exists(), "File is not moved");

String actual= fProject.getContent(fileToUpdate);
//reference has to be updated only once despite two changes are supplied.
assertEquals("using dest.fileToMove.txt;\nusing someOther.txt", actual);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.participants;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
Expand Down Expand Up @@ -119,12 +119,12 @@ public RefactoringParticipant[] loadParticipants(RefactoringStatus status, Shara
}
}

@Before
@BeforeEach
public void setUp() throws Exception {
fProject= new SimpleTestProject();
}

@After
@AfterEach
public void tearDown() throws Exception {
fProject.delete();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
*******************************************************************************/
package org.eclipse.ltk.core.refactoring.tests.resource;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.core.filesystem.EFS;

Expand Down Expand Up @@ -59,12 +59,12 @@
public class ResourceRefactoringTests {
private SimpleTestProject fProject;

@Before
@BeforeEach
public void setUp() throws Exception {
fProject= new SimpleTestProject();
}

@After
@AfterEach
public void tearDown() throws Exception {
fProject.delete();
}
Expand Down Expand Up @@ -304,7 +304,7 @@ public void testDeleteRefactoring1_bug343584() throws Exception {
IFolder testFolder= fProject.createFolder("test");
fProject.createFile(testFolder, "myFile.txt", "hello");

IProject testProject2= ResourcesPlugin.getWorkspace().getRoot().getProject(SimpleTestProject.TEST_PROJECT_NAME + "2");
IProject testProject2= ResourcesPlugin.getWorkspace().getRoot().getProject(fProject.getProject().getName() + "2");
try {
testProject2.create(null);
testProject2.open(null);
Expand Down Expand Up @@ -468,4 +468,4 @@ private IResource assertMoveRename(IResource source, IContainer destination, Str
}
return res;
}
}
}
Loading
Loading