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 @@ -25,7 +25,7 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.emf.common.util.WrappedException;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;
import org.mockito.stubbing.Answer;

import com.google.common.collect.LinkedHashMultimap;
Expand Down Expand Up @@ -179,7 +179,7 @@ public static void assertUnMocked() {
if (registrySpy != null) {
try {
String extensionPointId = configurationElements.keySet().iterator().next();
Assert.fail("Extension point " + extensionPointId + " still has mocked configuration elements."); //$NON-NLS-1$ //$NON-NLS-2$
Assertions.fail("Extension point " + extensionPointId + " still has mocked configuration elements."); //$NON-NLS-1$ //$NON-NLS-2$
} catch (NoSuchElementException e) { // shouldn't happen
throw new IllegalStateException("The extension registry mock is in an unexpected state.", e); //$NON-NLS-1$
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.Iterator;
import java.util.Map;

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


/**
Expand Down Expand Up @@ -49,7 +49,7 @@ public static void assertAllMocksRemoved() {
Iterator<Class<?>> iterator = originalServices.keySet().iterator();
while (iterator.hasNext()) {
Class<?> clazz = iterator.next();
Assert.fail("Service " + clazz.getName() + " is still mocked."); //$NON-NLS-1$//$NON-NLS-2$
Assertions.fail("Service " + clazz.getName() + " is still mocked."); //$NON-NLS-1$//$NON-NLS-2$
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;

import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -214,7 +214,7 @@ public final void deregister() {
* the expected number of jobs
*/
public final void assertNumberOfNewJobs(final int expected) {
Assert.assertEquals("Wrong number of jobs were scheduled", expected, newJobs.size());
Assertions.assertEquals(expected, newJobs.size(), "Wrong number of jobs were scheduled");
}

/**
Expand All @@ -227,13 +227,13 @@ public final void assertNumberOfNewJobs(final int expected) {
public final void assertNewJobsFinished() {
try {
List<Job> expectedJobs = Lists.newArrayList(newJobs);
Assert.assertFalse("No matching new jobs were scheduled: " + finder, expectedJobs.isEmpty());
Assertions.assertFalse(expectedJobs.isEmpty(), "No matching new jobs were scheduled: " + finder);
expectedJobs.removeAll(finishedJobs);
while (!expectedJobs.isEmpty()) {
try {
Job job = getNextJob();
if (job == null) {
Assert.fail("Expected new jobs did not finish after " + waitTimeout + " milliseconds: " + expectedJobs);
Assertions.fail("Expected new jobs did not finish after " + waitTimeout + " milliseconds: " + expectedJobs);
}
expectedJobs.remove(job);
} catch (InterruptedException e) {
Expand Down Expand Up @@ -261,7 +261,7 @@ public final void waitForExistingJobs() {
try {
Job job = getNextJob();
if (job == null) {
Assert.fail("Existing jobs did not finish after " + waitTimeout + " milliseconds: " + expectedJobs);
Assertions.fail("Existing jobs did not finish after " + waitTimeout + " milliseconds: " + expectedJobs);
}
expectedJobs.remove(job);
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package com.avaloq.tools.ddk.test.core.util;

import org.eclipse.core.runtime.IProgressMonitor;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;


/**
Expand Down Expand Up @@ -169,7 +169,7 @@ public void waitForTermination() {
final long timeStarted = System.currentTimeMillis();
while (!isTerminated()) {
long remainingWaitTime = TIMEOUT + timeStarted - System.currentTimeMillis();
Assert.assertFalse("Progress monitor did not get done signal", remainingWaitTime <= 0); //$NON-NLS-1$
Assertions.assertFalse(remainingWaitTime <= 0, "Progress monitor did not get done signal"); //$NON-NLS-1$
try {
this.wait(remainingWaitTime);
} catch (InterruptedException e) /* CHECKSTYLE:OFF */ {
Expand Down
1 change: 1 addition & 0 deletions com.avaloq.tools.ddk.test.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Require-Bundle: com.avaloq.tools.ddk.test.core,
org.eclipse.ui;visibility:=reexport,
org.hamcrest.library,
org.junit,
junit-jupiter-api,
org.mockito.mockito-core,
com.google.guava,
org.apache.commons.lang3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package com.avaloq.tools.ddk.test.ui.swtbot;

import static org.eclipse.swtbot.swt.finder.waits.Conditions.widgetIsEnabled;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.awt.AWTException;
import java.awt.Robot;
Expand Down Expand Up @@ -455,7 +455,7 @@ public static void openView(final SWTWorkbenchBot bot, final String category, fi
}
}
}
assertTrue("View or Category found", bot.button().isEnabled());
assertTrue(bot.button().isEnabled(), "View or Category found");
bot.button("OK").click();
}

Expand Down Expand Up @@ -498,7 +498,7 @@ public static SWTBotTreeItem findTreeItem(final SWTWorkbenchBot bot, final SWTBo
}
} while (itemCount > 0);

assertTrue("Searching TreeItem", itemFound);
assertTrue(itemFound, "Searching TreeItem");

return botTreeItem;

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

import static com.avaloq.tools.ddk.test.ui.swtbot.util.SwtBotWizardUtil.selectItem;
import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Arrays;

Expand Down Expand Up @@ -49,7 +49,7 @@ public class SwtWizardBot extends SwtWorkbenchBot {
public void closeWizard() {
SWTBotShell activeShell = activeShell();
boolean wizardIsActive = isWizard(activeShell);
assertTrue("Wizard is active on close", wizardIsActive);
assertTrue(wizardIsActive, "Wizard is active on close");
activeShell.close();
}

Expand Down Expand Up @@ -155,13 +155,13 @@ public void openExportWizard(final String wizardName) {
* name of the wizard to be activated
*/
private void activateWizard(final String wizardName) {
assertTrue("A wizard dialog must be active", syncExec(() -> {
assertTrue(syncExec(() -> {
SWTBotShell wizardShell = activeShell();
return wizardShell.widget.getData() instanceof WizardDialog;
}));
assertTrue("Wizard '" + wizardName + "' does not exist.", syncExec(() -> {
}), "A wizard dialog must be active");
assertTrue(syncExec(() -> {
return selectItem(tree(), wizardName);
}));
}), "Wizard '" + wizardName + "' does not exist.");
clickButton(NEXT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.ui.PlatformUI;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;

import com.avaloq.tools.ddk.test.ui.swtbot.SwtWorkbenchBot;

Expand Down Expand Up @@ -48,7 +48,7 @@ public static void selectProjectFolder(final SwtWorkbenchBot bot, final String f
final Tree tree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), comp);
PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
SWTBotTree botTree = new SWTBotTree(tree);
Assert.assertTrue("folder was not found", selectItem(botTree, folderName));
Assertions.assertTrue(selectItem(botTree, folderName), "folder was not found");
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package com.avaloq.tools.ddk.xtext.test;

// CHECKSTYLE:OFF
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.text.MessageFormat;
import java.util.concurrent.atomic.AtomicReference;
Expand All @@ -35,7 +35,7 @@
import org.eclipse.xtext.util.Pair;
import org.eclipse.xtext.util.StringInputStream;
import org.eclipse.xtext.util.Tuples;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;

import com.google.inject.Injector;

Expand Down Expand Up @@ -111,7 +111,7 @@ public AcfContentAssistProcessorTestBuilder applyText(final String expectedDispl
break;
}
}
assertNotNull(MessageFormat.format("\"{0}\" not a valid completion proposal", expectedDisplayString), proposal);
assertNotNull(proposal, MessageFormat.format("\"{0}\" not a valid completion proposal", expectedDisplayString));
String text = "";
if (proposal instanceof ConfigurableCompletionProposal) {
text = ((ConfigurableCompletionProposal) proposal).getReplacementString();
Expand Down Expand Up @@ -180,11 +180,11 @@ public ContentAssistProcessorTestBuilder assertMatchString(final String matchStr
ContentAssistContext.Factory factory = get(ContentAssistContext.Factory.class);
ContentAssistContext[] contexts = factory.create(sourceViewer, currentModelToParse.length(), xtextResource);
for (ContentAssistContext context : contexts) {
Assert.assertTrue("matchString = '" + matchString + "', actual: '" + context.getPrefix() + "'", "".equals(context.getPrefix())
|| matchString.equals(context.getPrefix()));
Assertions.assertTrue("".equals(context.getPrefix())
|| matchString.equals(context.getPrefix()), "matchString = '" + matchString + "', actual: '" + context.getPrefix() + "'");
}
} else {
Assert.fail("No content assistant for content type " + contentType);
Assertions.fail("No content assistant for content type " + contentType);
}
} catch (BadLocationException e) {
exception.set(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
*******************************************************************************/
package com.avaloq.tools.ddk.xtext.test.jupiter;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.fail;

import java.text.MessageFormat;
import java.util.Arrays;
Expand Down Expand Up @@ -90,7 +90,7 @@ private String getCompletionProposalDisplayStrings(final ICompletionProposal...
* the expected proposals as display strings
*/
private void assertCompletionProposal(final ICompletionProposal[] computedProposals, final boolean positiveTest, final String... proposals) {
assertNotEquals(AT_LEAST_ONE_PROPOSAL_WAS_PROVIDED, proposals.length, 0);
assertNotEquals(0, proposals.length, AT_LEAST_ONE_PROPOSAL_WAS_PROVIDED);
for (final String s : proposals) {
boolean foundProposal = false;
for (ICompletionProposal p : computedProposals) {
Expand Down Expand Up @@ -155,7 +155,7 @@ protected void assertNotCompletionProposal(final ICompletionProposal[] computedP
* the expected proposals as display strings
*/
protected void assertExactlyCompletionProposal(final ICompletionProposal[] computedProposals, final String... expectedProposals) {
assertNotEquals(AT_LEAST_ONE_PROPOSAL_WAS_PROVIDED, expectedProposals.length, 0);
assertNotEquals(0, expectedProposals.length, AT_LEAST_ONE_PROPOSAL_WAS_PROVIDED);

Set<String> computedProposalsAsSet = new HashSet<String>();
for (ICompletionProposal p : computedProposals) {
Expand Down Expand Up @@ -190,8 +190,8 @@ protected void assertExactlyCompletionProposal(final ICompletionProposal[] compu
private void assertSourceProposals(final String sourceFileName) {
try {
AcfContentAssistProcessorTestBuilder builder = newBuilder().append(getTestSource(sourceFileName).getContent());
assertFalse(EXPECTED_PROPOSALS_NOT_SET, (acfContentAssistMarkerTagInfo.expectedProposalMap.isEmpty()
&& acfContentAssistMarkerTagInfo.notExpectedProposalMap.isEmpty() && acfContentAssistMarkerTagInfo.expectedExactlyProposalMap.isEmpty()));
assertFalse((acfContentAssistMarkerTagInfo.expectedProposalMap.isEmpty()
&& acfContentAssistMarkerTagInfo.notExpectedProposalMap.isEmpty() && acfContentAssistMarkerTagInfo.expectedExactlyProposalMap.isEmpty()), EXPECTED_PROPOSALS_NOT_SET);
for (int markerId : getUsedTagsItems()) {
final ICompletionProposal[] proposals = builder.computeCompletionProposals(getOffsetForTag(markerId));
if (acfContentAssistMarkerTagInfo.expectedProposalMap.containsKey(markerId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;

import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
Expand Down Expand Up @@ -84,7 +84,7 @@ public <T extends EObject> Iterable<T> getAllInstancesOf(final EObject context,
// CHECKSTYLE:ON
return Iterables.filter(getAllInstancesOf(context, type), input -> {
if (input.eClass().getEStructuralFeature(feature.getFeatureID()) != feature) {
Assert.fail("Feature " + feature + " is not a feature of " + input.eClass()); //$NON-NLS-1$ //$NON-NLS-2$
Assertions.fail("Feature " + feature + " is not a feature of " + input.eClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
final Object valueOfFeature = input.eGet(feature);
return valueOfFeature != null && valueOfFeature.equals(value);
Expand Down