Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carstenartur committed Nov 1, 2024
1 parent 40af908 commit 5b26335
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*******************************************************************************/
package org.eclipse.jdt.text.tests.spelling;

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.net.MalformedURLException;
import java.net.URL;
Expand All @@ -25,9 +25,9 @@
import java.util.Locale;
import java.util.Set;

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.jface.preference.IPreferenceStore;

Expand Down Expand Up @@ -83,7 +83,7 @@ protected final boolean contains(Set<RankedWordProposal> words, String word) {
return false;
}

@Before
@BeforeEach
public void setUp() throws Exception {

fUSDictionary.addWord(TRUCK);
Expand All @@ -97,7 +97,7 @@ public void setUp() throws Exception {
fEngine.registerGlobalDictionary(fGlobalDictionary);
}

@After
@AfterEach
public void tearDown() throws Exception {

fUSDictionary.unload();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
*******************************************************************************/
package org.eclipse.jdt.text.tests.templates;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
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.assertTrue;

import java.util.Arrays;
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.jdt.testplugin.JavaProjectHelper;

Expand Down Expand Up @@ -54,15 +54,15 @@ public class TemplateCompletionTests {

private IPackageFragment pkg;

@Before
@BeforeEach
public void setUp() throws Exception {
fJProject= JavaProjectHelper.createJavaProject("TestProject", "bin");
JavaProjectHelper.addRTJar18(fJProject);
javaSrc= JavaProjectHelper.addSourceContainer(fJProject, "src");
pkg= javaSrc.createPackageFragment("test", false, null);
}

@After
@AfterEach
public void tearDown() throws Exception {
JavaProjectHelper.delete(fJProject);
}
Expand Down Expand Up @@ -102,7 +102,7 @@ public void testExepectNoProposals() throws Exception {
List<ICompletionProposal> proposals= computeCompletionProposals(cu, completionIndex);

boolean fail= proposals.stream().anyMatch(p -> "new_class - create new class".equals(p.getDisplayString()));
assertFalse("Proposal '" + propDisplay + "' should not exist", fail);
assertFalse(fail, "Proposal '" + propDisplay + "' should not exist");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.util.Iterator;

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

import org.eclipse.jface.text.templates.ContextTypeRegistry;
import org.eclipse.jface.text.templates.Template;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*******************************************************************************/
package org.eclipse.jdt.testplugin;

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

import java.io.File;
import java.io.FileInputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*******************************************************************************/
package org.eclipse.jdt.testplugin;

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

import org.eclipse.core.resources.IResource;

Expand Down Expand Up @@ -169,7 +169,7 @@ public static void assertNoMixedLineDelimiters(IJavaElement elem) {
}
public static void assertNoMixedLineDelimiters(IResource resource) {
IResource[] mixedResources= findFilesWithMixedLineDelimiters(resource);
Assert.assertTrue(mixedResources == null || mixedResources.length == 0);
Assertions.assertTrue(mixedResources == null || mixedResources.length == 0);
}

/**
Expand All @@ -186,7 +186,7 @@ private static IResource[] findFilesWithMixedLineDelimiters(final IResource reso
// engine.search(scope, false, collector, new LineDelimiterLocator(MIXED_LD));
// return (IResource[])result.toArray(new IResource[result.size()]);

Assert.fail("support currently disabled");
Assertions.fail("support currently disabled");

return new IResource[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.ArrayList;
import java.util.Arrays;

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


public class StringAsserts {
Expand Down Expand Up @@ -51,9 +51,9 @@ public static void assertEqualString(String actual, String expected) {
return;
}
if (actual == null) {
Assert.fail("Content not as expected: is 'null' expected: " + expected);
Assertions.fail("Content not as expected: is 'null' expected: " + expected);
} else {
Assert.fail("Content not as expected: expected 'null' is: " + actual);
Assertions.fail("Content not as expected: expected 'null' is: " + actual);
}
}

Expand All @@ -67,7 +67,7 @@ public static void assertEqualString(String actual, String expected) {
// use detailed message
String message= "Content not as expected: is\n" + actual + "\nDiffers at pos " + diffPos + ": " + diffStr + "\nexpected:\n" + expected; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

Assert.assertEquals(message, expected, actual);
Assertions.assertEquals(expected, actual, message);
}
}

Expand All @@ -77,9 +77,9 @@ public static void assertEqualStringIgnoreDelim(String actual, String expected)
return;
}
if (actual == null) {
Assert.fail("Content not as expected: is 'null' expected: " + expected);
Assertions.fail("Content not as expected: is 'null' expected: " + expected);
} else {
Assert.fail("Content not as expected: expected 'null' is: " + actual);
Assertions.fail("Content not as expected: expected 'null' is: " + actual);
}
}

Expand All @@ -98,7 +98,7 @@ public static void assertEqualStringIgnoreDelim(String actual, String expected)
String diffStr= (s1 == null) ? s2 : s1;

String message= "Content not as expected: Content is: \n" + actual + "\nDiffers at line " + line + ": " + diffStr + "\nExpected contents: \n" + expected;
Assert.assertEquals(message, expected, actual);
Assertions.assertEquals(expected, actual, message);
}
line++;
} while (true);
Expand Down Expand Up @@ -143,7 +143,7 @@ public static void assertEqualStringsIgnoreOrder(String[] actuals, String[] expe
String expected= buf.toString();

String message= "Content not as expected: Content is: \n" + actual + "\nExpected contents: \n" + expected;
Assert.assertEquals(message, expected, actual);
Assertions.assertEquals(expected, actual, message);
}
}

Expand Down Expand Up @@ -186,7 +186,7 @@ public static void assertExpectedExistInProposals(String[] actuals, String[] exp
String expected= buf.toString();

String message= "Content not as expected: Content is: \n" + actual + "\nExpected contents: \n" + expected;
Assert.assertEquals(message, expected, actual);
Assertions.assertEquals(expected, actual, message);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
*******************************************************************************/
package org.eclipse.jdt.junit.tests;

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

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

import org.eclipse.jdt.testplugin.util.DialogCheck;

Expand Down Expand Up @@ -99,12 +99,12 @@ protected void tabGroupSetDefaultTester(ILaunchConfigurationTabGroup testSubject
ILaunchConfigurationWorkingCopy wcFalse= getNewConfigWorkingCopy();
testSubject.createTabs(null, null);
testSubject.setDefaults(wcFalse);
assertFalse("Enable assertions argument should not be enabled", getAssertArgEnabled(wcFalse));
assertFalse(getAssertArgEnabled(wcFalse), "Enable assertions argument should not be enabled");

AssertionVMArg.setEnableAssertionsPreference(true);
ILaunchConfigurationWorkingCopy wcTrue= getNewConfigWorkingCopy();
testSubject.setDefaults(wcTrue);
assertTrue("Enable assertions argument should be enabled", getAssertArgEnabled(wcTrue));
assertTrue(getAssertArgEnabled(wcTrue), "Enable assertions argument should be enabled");
} catch (CoreException err) {
throw new RuntimeException(err);
} finally {
Expand Down
Loading

0 comments on commit 5b26335

Please sign in to comment.