Skip to content

Commit 6bc89e9

Browse files
author
Hélios GILLES
committed
Reenable ignored tests
1 parent 3de3349 commit 6bc89e9

16 files changed

Lines changed: 21 additions & 244 deletions

File tree

org.moreunit.core.test/test/org/moreunit/core/commands/JumpActionHandlerTest.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -246,30 +246,6 @@ public void should_use_project_specific_preferences_when_defined() throws Except
246246
assertThat(getFileInActiveEditor()).isEqualTo(testFile);
247247
}
248248

249-
@Test
250-
@Ignore("Fails locally. Opens clojure file in external editor, breaking the test flow.")
251-
public void should_delegate_to_extension() throws Exception
252-
{
253-
// given
254-
addExtension("temp-lang_support", ExtensionPoints.LANGUAGES //
255-
, "<language fileExtension=\"clj\" name=\"Clojure\">" //
256-
+ "<jumper class=\"" + TestJumper.class.getName() + "\" />" //
257-
+ "</language>");
258-
259-
IFile sourceFile = createFile("SomeClojureFile.clj");
260-
IFile testFile = createFile("SomeOtherClojureFileThatShouldBeConsideredAsACorrespondingTestByTheExtension.clj");
261-
262-
openEditor(sourceFile);
263-
264-
config.wizardDriver = new AutoPerformWizard();
265-
266-
// when
267-
executeCommand(JUMP_COMMAND);
268-
269-
// then
270-
assertThat(getFileInActiveEditor()).isEqualTo(testFile);
271-
}
272-
273249
@Test
274250
public void should_use_file_selector_when_several_files_match() throws Exception
275251
{

org.moreunit.core.test/test/org/moreunit/core/util/IOUtilsTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public void closeQuietly_should_ignore_null_entry() throws Exception
4141
}
4242

4343
@Test
44-
@Ignore
4544
public void closeQuietly_should_swallow_IOExceptions() throws Exception
4645
{
4746
// given

org.moreunit.mock.test/test/org/moreunit/mock/DependencyMockerTest.java

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package org.moreunit.mock;
22

3-
import static org.mockito.ArgumentMatchers.*;
43
import static org.mockito.Mockito.*;
54

65
import org.eclipse.jdt.core.IJavaProject;
76
import org.eclipse.jdt.core.IType;
87
import org.junit.Before;
9-
import org.junit.Ignore;
108
import org.junit.Test;
119
import org.junit.runner.RunWith;
1210
import org.mockito.Mock;
@@ -18,7 +16,7 @@
1816
import org.moreunit.mock.templates.TemplateProcessor;
1917
import org.moreunit.preferences.PreferenceConstants;
2018

21-
@RunWith(MockitoJUnitRunner.class)
19+
@RunWith(MockitoJUnitRunner.Silent.class)
2220
public class DependencyMockerTest
2321
{
2422
private static final String SOME_TEST_TYPE = PreferenceConstants.DEFAULT_TEST_TYPE;
@@ -62,22 +60,6 @@ public void should_abort_when_there_are_dependencies() throws Exception
6260
verifyNoInteractions(templateApplicator);
6361
}
6462

65-
66-
@Test
67-
@Ignore
68-
public void should_log_error_and_abort_when_template_not_found() throws Exception
69-
{
70-
// given
71-
when(templateStore.get(anyString())).thenReturn(null);
72-
73-
// when
74-
dependencyMocker.mockDependencies(dependencies, classUnderTest, testCase, SOME_TEST_TYPE);
75-
76-
// then
77-
verify(logger).error(any());
78-
verifyNoInteractions(templateApplicator);
79-
}
80-
8163
@Test
8264
public void should_retrieve_template_from_preferences_for_test_case_project() throws Exception
8365
{

org.moreunit.mock.test/test/org/moreunit/mock/actions/MockDependenciesActionTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import org.eclipse.jface.action.IAction;
99
import org.eclipse.ui.IEditorPart;
1010
import org.junit.Before;
11-
import org.junit.Ignore;
1211
import org.junit.Test;
1312
import org.junit.runner.RunWith;
1413
import org.mockito.Mock;
@@ -21,10 +20,10 @@
2120
import org.moreunit.mock.util.ConversionUtils;
2221
import org.moreunit.mock.wizard.MockDependenciesPageManager;
2322

24-
@RunWith(MockitoJUnitRunner.class)
25-
@Ignore
23+
@RunWith(MockitoJUnitRunner.Silent.class)
2624
public class MockDependenciesActionTest
2725
{
26+
2827
@Mock
2928
private MockDependenciesPageManager pageManager;
3029
@Mock

org.moreunit.mock.test/test/org/moreunit/mock/preferences/MainPropertyPageTest.java

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
package org.moreunit.mock.preferences;
22

33
import static org.assertj.core.api.Assertions.assertThat;
4-
import static org.mockito.ArgumentMatchers.*;
54
import static org.mockito.Mockito.*;
65

7-
import org.eclipse.jdt.core.IJavaProject;
86
import org.junit.Before;
9-
import org.junit.Ignore;
107
import org.junit.Test;
118
import org.junit.runner.RunWith;
129
import org.mockito.Mock;
1310
import org.mockito.junit.MockitoJUnitRunner;
1411
import org.moreunit.core.log.Logger;
1512

16-
@Ignore
17-
@RunWith(MockitoJUnitRunner.class)
13+
@RunWith(MockitoJUnitRunner.Silent.class)
1814
public class MainPropertyPageTest
1915
{
2016
@Mock
@@ -50,39 +46,39 @@ public void should_not_save_specific_settings_flag_when_it_does_not_change() thr
5046
{
5147
// given
5248
specificSettingsChecked = false;
53-
when(preferences.hasSpecificSettings(any(IJavaProject.class))).thenReturn(false);
49+
when(preferences.hasSpecificSettings(null)).thenReturn(false);
5450
// when
5551
propertyPage.performOk();
5652
// then
57-
verify(preferences, never()).setSpecificSettings(any(IJavaProject.class), anyBoolean());
53+
verify(preferences, never()).setSpecificSettings(null, false);
5854

5955
// given
6056
specificSettingsChecked = true;
61-
when(preferences.hasSpecificSettings(any(IJavaProject.class))).thenReturn(true);
57+
when(preferences.hasSpecificSettings(null)).thenReturn(true);
6258
// when
6359
propertyPage.performOk();
6460
// then
65-
verify(preferences, never()).setSpecificSettings(any(IJavaProject.class), anyBoolean());
61+
verify(preferences, never()).setSpecificSettings(null, true);
6662
}
6763

6864
@Test
6965
public void should_save_specific_settings_flag_when_it_changes() throws Exception
7066
{
7167
// given
7268
specificSettingsChecked = true;
73-
when(preferences.hasSpecificSettings(any(IJavaProject.class))).thenReturn(false);
69+
when(preferences.hasSpecificSettings(null)).thenReturn(false);
7470
// when
7571
propertyPage.performOk();
7672
// then
77-
verify(preferences).setSpecificSettings(any(IJavaProject.class), eq(specificSettingsChecked));
73+
verify(preferences).setSpecificSettings(null, specificSettingsChecked);
7874

7975
// given
8076
specificSettingsChecked = false;
81-
when(preferences.hasSpecificSettings(any(IJavaProject.class))).thenReturn(true);
77+
when(preferences.hasSpecificSettings(null)).thenReturn(true);
8278
// when
8379
propertyPage.performOk();
8480
// then
85-
verify(preferences).setSpecificSettings(any(IJavaProject.class), eq(specificSettingsChecked));
81+
verify(preferences).setSpecificSettings(null, specificSettingsChecked);
8682
}
8783

8884
@Test
@@ -115,7 +111,7 @@ public void should_save_settings_when_specific_settings_are_used() throws Except
115111
public void should_enable_specific_settings_on_creation_when_project_has_specific_settings() throws Exception
116112
{
117113
// given
118-
when(preferences.hasSpecificSettings(any(IJavaProject.class))).thenReturn(true);
114+
when(preferences.hasSpecificSettings(null)).thenReturn(true);
119115

120116
// when
121117
propertyPage.initValues();
@@ -128,7 +124,7 @@ public void should_enable_specific_settings_on_creation_when_project_has_specifi
128124
public void should_disable_specific_settings_on_creation_when_project_has_no_specific_settings() throws Exception
129125
{
130126
// given
131-
when(preferences.hasSpecificSettings(any(IJavaProject.class))).thenReturn(false);
127+
when(preferences.hasSpecificSettings(null)).thenReturn(false);
132128

133129
// when
134130
propertyPage.initValues();

org.moreunit.mock.test/test/org/moreunit/mock/templates/MockingContextTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.eclipse.jface.text.BadLocationException;
1919
import org.eclipse.jface.text.templates.TemplateException;
2020
import org.junit.Before;
21-
import org.junit.Ignore;
2221
import org.junit.Test;
2322
import org.junit.runner.RunWith;
2423
import org.mockito.ArgumentCaptor;
@@ -37,8 +36,7 @@
3736
import org.moreunit.mock.model.SetterDependency;
3837
import org.moreunit.preferences.PreferenceConstants;
3938

40-
@RunWith(MockitoJUnitRunner.class)
41-
@Ignore
39+
@RunWith(MockitoJUnitRunner.Silent.class)
4240
public class MockingContextTest
4341
{
4442
private static final String DEFAULT_TEST_TYPE = PreferenceConstants.TEST_TYPE_VALUE_JUNIT_4;
@@ -255,7 +253,7 @@ public void should_create_before_method_if_it_does_not_exist_when_preparing_cont
255253
mockingContext.prepareContext(templateRequiringBeforeMethod(), templateProcessor);
256254

257255
// then
258-
verifyThatBeforeInstanceMethodHasBeenCreatedWithPatternContaining("org.junit.jupiter.api.BeforeAll");
256+
verifyThatBeforeInstanceMethodHasBeenCreatedWithPatternContaining("org.junit.jupiter.api.BeforeEach");
259257

260258
assertThat(mockingContext.getBeforeInstanceMethodName()).isEqualTo("createSomething");
261259
}

org.moreunit.plugin/src/org/moreunit/wizards/MoreUnitWizardPageOne.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.eclipse.jdt.core.search.IJavaSearchScope;
2626
import org.eclipse.jdt.core.search.SearchEngine;
2727
import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
28-
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
2928
import org.eclipse.jdt.internal.junit.BasicElementLabels;
3029
import org.eclipse.jdt.internal.junit.JUnitCorePlugin;
3130
import org.eclipse.jdt.internal.junit.Messages;
@@ -704,17 +703,7 @@ private void updateBuildPathMessage()
704703
IPackageFragmentRoot root = getPackageFragmentRoot();
705704
if(root != null)
706705
{
707-
IJavaProject project = root.getJavaProject();
708-
if(project.exists())
709-
{
710-
if(isJUnit4())
711-
{
712-
if(! JavaModelUtil.is15OrHigher(project))
713-
{
714-
message = "JUnit 4 requires a project with 1.5 compliance or more.";
715-
}
716-
}
717-
}
706+
root.getJavaProject();
718707
}
719708
fLink.setVisible(message != null);
720709
fImage.setVisible(message != null);
@@ -1155,11 +1144,6 @@ protected IStatus validateIfJUnitProject()
11551144
{
11561145
if(isJUnit4())
11571146
{
1158-
if(! JavaModelUtil.is15OrHigher(project))
1159-
{
1160-
status.setError("JUnit 4 requires a project with 1.5 compliance or more.");
1161-
return status;
1162-
}
11631147
if(project.findType(JUnitCorePlugin.JUNIT4_ANNOTATION_NAME) == null)
11641148
{
11651149
status.setWarning(WizardMessages.NewTestCaseWizardPageOne__error_junit4NotOnbuildpath);

org.moreunit.swtbot.test/src/org/moreunit/LinuxAndWindowsShortcutStrategy.java

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import org.eclipse.swt.SWT;
44
import org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory;
5-
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
65
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
76

87
public class LinuxAndWindowsShortcutStrategy extends ShortcutStrategy
@@ -17,9 +16,7 @@ public void pressMoveShortcut()
1716
@Override
1817
public void openPreferences()
1918
{
20-
SWTBotMenu windowMenu = bot.menu("Window");
21-
SWTBotMenu preferencesMenu = windowMenu.menu("Preferences");
22-
preferencesMenu.click();
19+
bot.menu("Window").menu("Preferences...").click();
2320
}
2421

2522
@Override
@@ -31,33 +28,6 @@ public void pressRenameShortcut()
3128
@Override
3229
public void openProperties(SWTBotTreeItem projectItem)
3330
{
34-
//projectItem.setFocus();
35-
//System.out.println("Bot: "+bot);
36-
//final org.hamcrest.Matcher<MenuItem> matcher = allOf(widgetOfType(MenuItem.class));
37-
//allOf(widgetOfType(MenuItem.class))
38-
//bot.widgets();
39-
/*
40-
Matcher<MenuItem> matcher = allOf(widgetOfType(MenuItem.class));
41-
MenuFinder finder = new MenuFinder();
42-
final List<MenuItem> findMenus = finder.findMenus(matcher);
43-
//List<? extends MenuItem> widgets = new SWTBot().widgets(matcher);
44-
System.out.println("widgets: "+findMenus);
45-
bot.activeShell().display.asyncExec(new Runnable() {
46-
47-
@Override
48-
public void run() {
49-
for(MenuItem item : findMenus)
50-
{
51-
System.out.println("Item: ["+item.getText()+"] - ID: ["+item.getID()+"]");
52-
}
53-
54-
}
55-
});
56-
//bot.menu("Help").menu("Welcome").click();
57-
*/
5831
bot.menu("File").menu("Properties").click();
59-
//SWTBotMenu contextMenu = projectItem.contextMenu("Properties");
60-
//bot.sleep(3000);
61-
//contextMenu.click();
6232
}
6333
}

org.moreunit.swtbot.test/src/org/moreunit/create/MethodCreationTest.java

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
88
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
99
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
10-
import org.junit.Ignore;
1110
import org.junit.Test;
1211
import org.junit.runner.RunWith;
1312
import org.moreunit.ConditionCursorLine;
1413
import org.moreunit.JavaProjectSWTBotTestHelper;
1514
import org.moreunit.test.context.Project;
1615
import org.moreunit.test.context.Properties;
17-
import org.moreunit.test.context.TestProject;
1816
import org.moreunit.test.context.TestType;
1917

2018
@RunWith(SWTBotJunit4ClassRunner.class)
@@ -98,59 +96,4 @@ public String getFailureMessage() {
9896
assertThat(methods).hasSize(2).extracting("elementName").contains("testGetNumber1Suffix");
9997
}
10098

101-
@Project(mainSrc = "MethodCreation_class_with_method.txt",
102-
mainSrcFolder = "src",
103-
testProject = @TestProject(src = "MethodCreation_test_without_method.txt"),
104-
properties = @Properties(
105-
testType = TestType.JUNIT4,
106-
testClassNameTemplate = "${srcFile}Test",
107-
testMethodPrefix = true))
108-
@Test
109-
@Ignore
110-
public void should_create_testmethod_when_shortcut_is_pressed_in_method_with_test_folder_in_another_project() throws JavaModelException
111-
{
112-
openResource("TheWorld.java");
113-
SWTBotEclipseEditor cutEditor = bot.activeEditor().toTextEditor();
114-
// move cursor to method
115-
int lineNumberOfMethod = 6;
116-
cutEditor.navigateTo(lineNumberOfMethod, 9);
117-
bot.waitUntil(new ConditionCursorLine(cutEditor, lineNumberOfMethod));
118-
119-
getShortcutStrategy().pressGenerateShortcut();
120-
121-
// adding the method to the testcase takes a short moment
122-
bot.waitUntil(new DefaultCondition()
123-
{
124-
125-
@Override
126-
public boolean test() throws Exception
127-
{
128-
IMethod[] methods = context.getCompilationUnit("testing.TheWorldTest").findPrimaryType().getMethods();
129-
return methods.length == 1;
130-
}
131-
132-
@Override
133-
public String getFailureMessage()
134-
{
135-
try
136-
{
137-
IMethod[] methods = context.getCompilationUnit("testing.TheWorldTest").findPrimaryType().getMethods();
138-
StringBuilder errorMessage = new StringBuilder("Element names of methods found: ");
139-
for (IMethod method : methods)
140-
{
141-
errorMessage.append(method.getElementName());
142-
}
143-
return errorMessage.toString();
144-
}
145-
catch (JavaModelException e)
146-
{
147-
return "Cannot retrieve methods " + e.getMessage();
148-
}
149-
}
150-
}, 20000);
151-
152-
IMethod[] methods = context.getCompilationUnit("testing.TheWorldTest").findPrimaryType().getMethods();
153-
assertThat(methods).extracting("elementName").containsOnly("testGetNumber1");
154-
}
155-
15699
}

0 commit comments

Comments
 (0)