1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 472765: change from easymock to mockito

Due to improvements in target platform in 12843ef it is now possible to
use mockito instead of easymock. This commit does that switch.

Note because of Bug 334540 we need to explicitly require the org.hamcrest
bundle so that it resolves. From the bug, Matthias Sohn says in Comment 1:
"I would just use Require-Bundle to get around this."

Change-Id: Ib49a767c826aa04f4daf1de0bf1b25a4f8ae07ba
Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
This commit is contained in:
Jonah Graham 2016-01-19 13:45:57 +00:00 committed by Gerrit Code Review @ Eclipse.org
parent e9620b8a0e
commit 6d5d0be628
3 changed files with 12 additions and 15 deletions

View file

@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.gdb,
org.eclipse.cdt.dsf.gdb,
org.eclipse.core.variables,
org.easymock
org.mockito,
org.hamcrest
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ClassPath: .

View file

@ -10,9 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
@ -20,6 +17,8 @@ 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.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.io.File;
import java.nio.file.Files;
@ -571,14 +570,13 @@ public class SourceLookupTest extends BaseTestCase {
protected IBinary createMockIBinary(String path) {
IPath absPath = new Path(new File(path).getAbsolutePath());
IResource exeResource = createNiceMock(IResource.class);
expect(exeResource.getFullPath()).andReturn(absPath);
expect(exeResource.getProject()).andReturn(null);
replay(exeResource);
IResource exeResource = mock(IResource.class);
when(exeResource.getFullPath()).thenReturn(absPath);
when(exeResource.getProject()).thenReturn(null);
IBinary exeBin = createNiceMock(IBinary.class);
expect(exeBin.getPath()).andReturn(absPath);
expect(exeBin.getAdapter(IResource.class)).andReturn(exeResource);
IBinary exeBin = mock(IBinary.class);
when(exeBin.getPath()).thenReturn(absPath);
when(exeBin.getAdapter(IResource.class)).thenReturn(exeResource);
/*
* we use the adapter factory CSourceFinderFactory to convert IBinary to
* ISourceFinder. The way the adapter is resolved it will first try and
@ -587,8 +585,7 @@ public class SourceLookupTest extends BaseTestCase {
* explicitly provide the null, an exception would be raised because an
* unexpected method is invoked.
*/
expect(exeBin.getAdapter(ISourceFinder.class)).andReturn(null);
replay(exeBin);
when(exeBin.getAdapter(ISourceFinder.class)).thenReturn(null);
return exeBin;
}

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?><target name="cdt" sequenceNumber="5">
<?pde version="3.8"?><target name="cdt" sequenceNumber="6">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.apache.commons.compress" version="0.0.0"/>
@ -13,7 +13,6 @@
<unit id="org.hamcrest" version="0.0.0"/>
<unit id="org.hamcrest.core" version="0.0.0"/>
<unit id="com.google.gson" version="0.0.0"/>
<unit id="org.easymock" version="0.0.0"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20150519210750/repository/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">