Skip to content
Merged
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 @@ -17,26 +17,28 @@

package org.eclipse.ant.tests.ui.editor;

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.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.List;

import org.eclipse.ant.internal.ui.model.AntElementNode;
import org.eclipse.ant.internal.ui.model.AntModel;
import org.eclipse.ant.internal.ui.model.IAntElement;
import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
import org.eclipse.ant.tests.ui.testplugin.AntModelForDocument;
import org.eclipse.ant.tests.ui.testplugin.AntUITest;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Tests the correct creation of the outline for an xml file.
*/
public class AntEditorContentOutlineTests extends AbstractAntUITest {
@AntUITest
public class AntEditorContentOutlineTests {

/**
* Tests the creation of the AntElementNode, that includes parsing a file and determining the correct location of the tags.
Expand Down Expand Up @@ -167,7 +169,7 @@ public void testWithProjectOnlyBuildFile() {
public void testWithEmptyBuildFile() {
AntModel model = new AntModelForDocument("empty.xml").getAntModel(); //$NON-NLS-1$
AntElementNode rootProject = model.getProjectNode();
assertTrue(rootProject == null);
assertNull(rootProject);
}

/**
Expand Down Expand Up @@ -207,9 +209,11 @@ public void testAdvancedTaskLocation() throws BadLocationException {
@Test
public void testInternalTargets() {
AntModel model = new AntModelForDocument("internalTargets.xml").getAntModel(); //$NON-NLS-1$
assertTrue("Target without description should be internal", model.getTargetNode("internal1").isInternal()); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue("Target with name starting with '-' should be internal", model.getTargetNode("-internal2").isInternal()); //$NON-NLS-1$ //$NON-NLS-2$
assertFalse("Target with description attribute should not be internal", model.getTargetNode("non-internal").isInternal()); //$NON-NLS-1$ //$NON-NLS-2$
assertFalse("Default target should not be internal", model.getTargetNode("-default").isInternal()); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(model.getTargetNode("internal1").isInternal(), "Target without description should be internal"); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(model.getTargetNode("-internal2").isInternal(), //$NON-NLS-1$
"Target with name starting with '-' should be internal\""); //$NON-NLS-1$
assertFalse(model.getTargetNode("non-internal").isInternal(), //$NON-NLS-1$
"Target with description attribute should not be internal"); //$NON-NLS-1$
assertFalse(model.getTargetNode("-default").isInternal(), "Default target should not be internal"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.eclipse.ant.internal.ui.editor.AntEditor;
import org.eclipse.ant.internal.ui.editor.text.XMLTextHover;
import org.eclipse.ant.tests.ui.editor.performance.EditorTestHelper;
import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
import org.eclipse.ant.tests.ui.testplugin.AntUITest;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
Expand All @@ -36,7 +36,8 @@
import org.junit.Test;

@SuppressWarnings("restriction")
public class AntEditorTests extends AbstractAntUITest {
@AntUITest
public class AntEditorTests {

@Test
public void testHoverForPath() throws PartInitException, BadLocationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getBuildFile;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getIFile;
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.assertTrue;
import static org.junit.Assert.fail;
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.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.io.File;
import java.io.IOException;
Expand All @@ -45,16 +45,16 @@
import org.eclipse.ant.internal.ui.editor.AntEditor;
import org.eclipse.ant.tests.ui.editor.performance.EditorTestHelper;
import org.eclipse.ant.tests.ui.editor.support.TestTextCompletionProcessor;
import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
import org.eclipse.ant.tests.ui.testplugin.AntModelForDocument;
import org.eclipse.ant.tests.ui.testplugin.AntUITest;
import org.eclipse.core.internal.runtime.XmlProcessorFactory;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.ui.PartInitException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
Expand All @@ -64,7 +64,8 @@
* Tests everything about code completion and code assistance.
*/
@SuppressWarnings("restriction")
public class CodeCompletionTest extends AbstractAntUITest {
@AntUITest
public class CodeCompletionTest {

private static final String ANT_EDITOR_ID = "org.eclipse.ant.ui.internal.editor.AntEditor"; //$NON-NLS-1$

Expand Down Expand Up @@ -474,7 +475,7 @@ private void assertContains(String displayString, ICompletionProposal[] proposal
break;
}
}
assertTrue("Did not find displayString: " + displayString, found); //$NON-NLS-1$
assertTrue(found, "Did not find displayString: " + displayString); //$NON-NLS-1$
}

/**
Expand All @@ -489,7 +490,7 @@ private void assertDoesNotContain(String displayString, ICompletionProposal[] pr
break;
}
}
assertFalse("Found displayString: " + displayString, found); //$NON-NLS-1$
assertFalse(found, "Found displayString: " + displayString); //$NON-NLS-1$
}

/**
Expand Down Expand Up @@ -620,7 +621,8 @@ public void testMacrodefAttributeProposals() throws BadLocationException {
assertThat(proposals).hasSize(2);
assertContains("v", proposals); //$NON-NLS-1$
assertContains("eclipse", proposals); //$NON-NLS-1$
assertTrue("Additional proposal information not correct", proposals[1].getAdditionalProposalInfo().startsWith("Testing Eclipse")); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(proposals[1].getAdditionalProposalInfo().startsWith("Testing Eclipse"), //$NON-NLS-1$
"Additional proposal information not correct"); //$NON-NLS-1$
processor.dispose();
}

Expand Down Expand Up @@ -662,8 +664,9 @@ public void testMacrodefElementProposals() throws BadLocationException {
processor.setCursorPosition(lineOffset + columnNumber);
ICompletionProposal[] proposals = processor.getProposalsFromDocument(document, ""); //$NON-NLS-1$
assertThat(proposals).hasSize(1);
assertTrue("Proposal not correct", proposals[0].getDisplayString().equals("some-tasks")); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue("Additional proposal information not correct", proposals[0].getAdditionalProposalInfo().endsWith("Not required")); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(proposals[0].getDisplayString().equals("some-tasks"), "Proposal not correct"); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(proposals[0].getAdditionalProposalInfo().endsWith("Not required"), //$NON-NLS-1$
"Additional proposal information not correct"); //$NON-NLS-1$
processor.dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,27 @@
package org.eclipse.ant.tests.ui.editor;

import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getIFile;
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.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.List;

import org.eclipse.ant.internal.ui.editor.AntEditor;
import org.eclipse.ant.internal.ui.editor.OccurrencesFinder;
import org.eclipse.ant.tests.ui.editor.performance.EditorTestHelper;
import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
import org.eclipse.ant.tests.ui.testplugin.AntUITest;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
import org.eclipse.ui.PartInitException;
import org.junit.Test;
import org.junit.jupiter.api.Test;

@SuppressWarnings("restriction")
public class OccurrencesFinderTests extends AbstractAntUITest {
@AntUITest
public class OccurrencesFinderTests {

@Test
public void testFromPropertyName() throws PartInitException, BadLocationException {
Expand All @@ -51,8 +54,8 @@ public void testFromPropertyName() throws PartInitException, BadLocationExceptio
private void propertyOccurences(AntEditor editor, int offset) throws BadLocationException {
OccurrencesFinder finder = getOccurrencesFinder(editor, offset);
List<Position> positions = finder.perform();
assertNotNull("Expecting a position listing", positions); //$NON-NLS-1$
assertTrue("7 positions should have been found; found: " + positions.size(), positions.size() == 7); //$NON-NLS-1$
assertNotNull(positions, "Expecting a position listing"); //$NON-NLS-1$
assertEquals(7, positions.size());
assertContainsPosition(positions, offset, 8);
int newoffset = getOffsetWithinLine(editor, 34, 21);
assertContainsPosition(positions, newoffset, 8);
Expand Down Expand Up @@ -98,8 +101,8 @@ public void testPropertyRefFromTaskText() throws PartInitException, BadLocationE
editor.selectAndReveal(offset, 50);
OccurrencesFinder finder = getOccurrencesFinder(editor, offset);
List<Position> positions = finder.perform();
assertNotNull("Expecting a position listing", positions); //$NON-NLS-1$
assertTrue("3 positions should have been found; found: " + positions.size(), positions.size() == 3); //$NON-NLS-1$
assertNotNull(positions, "Expecting a position listing"); //$NON-NLS-1$
assertEquals(3, positions.size());
assertContainsPosition(positions, offset, 15);
offset = getOffsetWithinLine(editor, 40, 20);
assertContainsPosition(positions, offset, 15);
Expand All @@ -109,8 +112,8 @@ public void testPropertyRefFromTaskText() throws PartInitException, BadLocationE
editor.selectAndReveal(offset, 10);
finder = getOccurrencesFinder(editor, offset);
positions = finder.perform();
assertNotNull("Expecting a position listing", positions); //$NON-NLS-1$
assertTrue("3 positions should have been found; found: " + positions.size(), positions.size() == 3); //$NON-NLS-1$
assertNotNull(positions, "Expecting a position listing"); //$NON-NLS-1$
assertEquals(3, positions.size());
assertContainsPosition(positions, offset, 15);
offset = getOffsetWithinLine(editor, 39, 20);
assertContainsPosition(positions, offset, 15);
Expand Down Expand Up @@ -139,7 +142,7 @@ public void testFromMacrodefAttributeDecl() throws PartInitException, BadLocatio
private void macrodefAttributeOccurences(AntEditor editor, int offset) throws BadLocationException {
OccurrencesFinder finder = getOccurrencesFinder(editor, offset);
List<Position> positions = finder.perform();
assertTrue("6 positions should have been found; found: " + positions.size(), positions.size() == 6); //$NON-NLS-1$
assertEquals(6, positions.size());
assertContainsPosition(positions, offset, 7);
int newoffset = getOffsetWithinLine(editor, 19, 32);
assertContainsPosition(positions, newoffset, 7);
Expand Down Expand Up @@ -170,7 +173,7 @@ public void testTargetFromAnt() throws PartInitException, BadLocationException {

OccurrencesFinder finder = getOccurrencesFinder(editor, offset);
List<Position> positions = finder.perform();
assertTrue("4 positions should have been found; found: " + positions.size(), positions.size() == 4); //$NON-NLS-1$
assertEquals(4, positions.size());
assertContainsPosition(positions, offset, 7);
offset = getOffsetWithinLine(editor, 10, 16);
assertContainsPosition(positions, offset, 7);
Expand All @@ -192,7 +195,7 @@ public void testTargetFromAntCall() throws PartInitException, BadLocationExcepti

OccurrencesFinder finder = getOccurrencesFinder(editor, offset);
List<Position> positions = finder.perform();
assertTrue("4 positions should have been found; found: " + positions.size(), positions.size() == 4); //$NON-NLS-1$
assertEquals(4, positions.size());
assertContainsPosition(positions, offset, 7);
offset = getOffsetWithinLine(editor, 10, 16);
assertContainsPosition(positions, offset, 7);
Expand All @@ -217,7 +220,7 @@ public void testTargetFromProjectDefault() throws PartInitException, BadLocation

OccurrencesFinder finder = getOccurrencesFinder(editor, offset);
List<Position> positions = finder.perform();
assertTrue("2 positions should have been found; found: " + positions.size(), positions.size() == 2); //$NON-NLS-1$
assertEquals(2, positions.size());
assertContainsPosition(positions, offset, 7);
offset = getOffsetWithinLine(editor, 1, 45);
assertContainsPosition(positions, offset, 7);
Expand All @@ -241,7 +244,7 @@ public void testTargetFromTargetDepends() throws PartInitException, BadLocationE
OccurrencesFinder finder = getOccurrencesFinder(editor, offset);
// from the declaration
List<Position> positions = finder.perform();
assertTrue("2 positions should have been found; found: " + positions.size(), positions.size() == 2); //$NON-NLS-1$
assertEquals(2, positions.size());
assertContainsPosition(positions, offset, 7);
offset = getOffsetWithinLine(editor, 5, 20);
assertContainsPosition(positions, offset, 7);
Expand All @@ -250,14 +253,14 @@ public void testTargetFromTargetDepends() throws PartInitException, BadLocationE
offset = getOffsetWithinLine(editor, 5, 20);
finder = getOccurrencesFinder(editor, offset);
positions = finder.perform();
assertTrue("2 positions should have been found; found: " + positions.size(), positions.size() == 2); //$NON-NLS-1$
assertEquals(2, positions.size());

// from the description
offset = getOffsetWithinLine(editor, 1, 30);
editor.selectAndReveal(offset, 0);
finder = getOccurrencesFinder(editor, offset);
positions = finder.perform();
assertTrue("No positions should have been found", positions == null); //$NON-NLS-1$
assertNull(positions);
}
finally {
EditorTestHelper.closeAllEditors();
Expand Down Expand Up @@ -292,7 +295,7 @@ public void testNoRefFromProjectDefault() throws PartInitException, BadLocationE

OccurrencesFinder finder = getOccurrencesFinder(editor, offset);
List<Position> positions = finder.perform();
assertTrue("No positions should have been found", positions == null); //$NON-NLS-1$
assertNull(positions);
}
finally {
EditorTestHelper.closeAllEditors();
Expand Down Expand Up @@ -336,7 +339,7 @@ public void testPropertyAndTargetWithSameName() throws PartInitException, BadLoc

OccurrencesFinder finder = getOccurrencesFinder(editor, offset);
List<Position> positions = finder.perform();
assertTrue("2 positions should have been found; found: " + positions.size(), positions.size() == 2); //$NON-NLS-1$
assertEquals(2, positions.size());
assertContainsPosition(positions, offset, 4);
offset = getOffsetWithinLine(editor, 6, 17);
assertContainsPosition(positions, offset, 4);
Expand All @@ -346,7 +349,7 @@ public void testPropertyAndTargetWithSameName() throws PartInitException, BadLoc
editor.selectAndReveal(offset, 0);
finder = getOccurrencesFinder(editor, offset);
positions = finder.perform();
assertTrue("2 positions should have been found; found: " + positions.size(), positions.size() == 2); //$NON-NLS-1$
assertEquals(2, positions.size());
assertContainsPosition(positions, offset, 4);
offset = getOffsetWithinLine(editor, 7, 12);
assertContainsPosition(positions, offset, 4);
Expand All @@ -364,7 +367,7 @@ private void assertContainsPosition(List<Position> positions, int offset, int le
break;
}
}
assertTrue("Did not find position at offset: " + offset + " length: " + length, found); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(found, "Did not find position at offset: " + offset + " length: " + length); //$NON-NLS-1$ //$NON-NLS-2$
}

private OccurrencesFinder getOccurrencesFinder(AntEditor editor, int offset) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@

package org.eclipse.ant.tests.ui.editor;

import static org.junit.Assert.assertEquals;
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.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.eclipse.ant.internal.ui.editor.TaskDescriptionProvider;
import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
import org.junit.Test;
import org.eclipse.ant.tests.ui.testplugin.AntUITest;
import org.junit.jupiter.api.Test;

/**
* Tests the tasks description provider.
*/
@SuppressWarnings("restriction")
public class TaskDescriptionProviderTest extends AbstractAntUITest {
@AntUITest
public class TaskDescriptionProviderTest {

/**
* Tests getting the description of a task.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
*******************************************************************************/
package org.eclipse.ant.tests.ui.editor.formatter;

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

import org.eclipse.ant.internal.ui.editor.formatter.FormattingPreferences;
import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
import org.junit.Test;
import org.eclipse.ant.tests.ui.testplugin.AntUITest;
import org.junit.jupiter.api.Test;

@SuppressWarnings("restriction")
public class FormattingPreferencesTest extends AbstractAntUITest {
@AntUITest
public class FormattingPreferencesTest {

@Test
public final void testGetCanonicalIndent() {
Expand Down
Loading
Loading