Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JBIDE-18690 - ResourceException while deleting project
- Loading branch information
Showing
3 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...jaxrs.ui.test/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriMappingsContentProviderTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* | ||
*/ | ||
package org.jboss.tools.ws.jaxrs.ui.cnf; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.core.runtime.CoreException; | ||
import org.eclipse.jdt.core.IJavaProject; | ||
import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsMetamodel; | ||
import org.jboss.tools.ws.jaxrs.core.junitrules.JaxrsMetamodelMonitor; | ||
import org.jboss.tools.ws.jaxrs.core.junitrules.WorkspaceSetupRule; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.ClassRule; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
/** | ||
* @author xcoulon | ||
* | ||
*/ | ||
public class UriMappingsContentProviderTestCase { | ||
|
||
@ClassRule | ||
public static WorkspaceSetupRule workspaceSetupRule = new WorkspaceSetupRule("org.jboss.tools.ws.jaxrs.tests.sampleproject"); | ||
|
||
@Rule | ||
public JaxrsMetamodelMonitor metamodelMonitor = new JaxrsMetamodelMonitor("org.jboss.tools.ws.jaxrs.tests.sampleproject", true); | ||
|
||
private JaxrsMetamodel metamodel = null; | ||
|
||
private IProject project = null; | ||
|
||
private IJavaProject javaProject = null; | ||
|
||
@Before | ||
public void setup() throws CoreException { | ||
this.metamodel = metamodelMonitor.getMetamodel(); | ||
this.project = metamodel.getProject(); | ||
this.javaProject = metamodel.getJavaProject(); | ||
} | ||
|
||
@Test | ||
// @see https://issues.jboss.org/browse/JBIDE-18690 | ||
public void shouldReturnTrueWhenProjectExists() { | ||
// given | ||
final UriMappingsContentProvider uriMappingsContentProvider = new UriMappingsContentProvider(); | ||
final UriPathTemplateCategory uriPathTemplateCategory = new UriPathTemplateCategory(uriMappingsContentProvider, javaProject); | ||
// when | ||
boolean hasChildren = uriMappingsContentProvider.hasChildren(uriPathTemplateCategory); | ||
// then | ||
Assert.assertThat(hasChildren, equalTo(true)); | ||
} | ||
|
||
@Test | ||
// @see https://issues.jboss.org/browse/JBIDE-18690 | ||
public void shouldNotFailWhenProjectIsDeleted() throws CoreException { | ||
// given | ||
final UriMappingsContentProvider uriMappingsContentProvider = new UriMappingsContentProvider(); | ||
final UriPathTemplateCategory uriPathTemplateCategory = new UriPathTemplateCategory(uriMappingsContentProvider, javaProject); | ||
// when | ||
project.delete(true, null); | ||
boolean hasChildren = uriMappingsContentProvider.hasChildren(uriPathTemplateCategory); | ||
// then | ||
Assert.assertThat(hasChildren, equalTo(false)); | ||
} | ||
} |