Skip to content

Commit

Permalink
FORGE-2459: Tests should always close ShellTest in an @after method
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Aug 26, 2015
1 parent e51f83b commit f9c6a86
Show file tree
Hide file tree
Showing 63 changed files with 483 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.jboss.forge.furnace.container.simple.Service;
import org.jboss.forge.furnace.container.simple.lifecycle.SimpleContainer;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -54,6 +55,12 @@ public void setUp()
test = SimpleContainer.getServices(getClass().getClassLoader(), ShellTest.class).get();
}

@After
public void tearDown() throws Exception
{
test.close();
}

@Test
public void testAddonListCommand() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public static AddonArchive getDeployment()
AddonDependencyEntry.create("org.jboss.forge.addon:configuration"),
AddonDependencyEntry.create("org.jboss.forge.addon:shell-test-harness"),
AddonDependencyEntry.create("org.jboss.forge.addon:projects"),
AddonDependencyEntry.create("org.jboss.forge.addon:shell")
);
AddonDependencyEntry.create("org.jboss.forge.addon:shell"));

return archive;
}
Expand Down Expand Up @@ -176,5 +175,6 @@ public void tearDown() throws Exception
{
userConfig.clearProperty("key1");
userConfig.clearProperty("key2");
test.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.jboss.forge.furnace.util.OperatingSystemUtils;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.FileAsset;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -80,6 +81,12 @@ public void setup() throws Exception
commandController = testHarness.createCommandController(JavaFormatSourcesCommand.class);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

// Runs the test on the command specifying the format sources and the format profile.
@Test
public void testFileFormattingWithProfileAndSourceInput() throws Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ public void shouldCreateOneErrorPageForEachErrorCode() throws Exception
}

@After
public void tearDown()
public void tearDown() throws Exception
{
if (project != null)
project.getRoot().delete(true);
shellTest.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.roaster.model.JavaClass;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -73,6 +74,12 @@ public void setUp()
projectHelper.installCDI_1_0(project);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void checkCommandMetadata() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.jboss.forge.roaster.model.Method;
import org.jboss.forge.roaster.model.Parameter;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -78,6 +79,12 @@ public void setUp()
projectHelper.installCDI_1_0(project);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void checkCommandMetadata() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.jboss.forge.arquillian.AddonDependencies;
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -54,6 +55,12 @@ public void before() throws IOException
shellTest.clearScreen();
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void testListAlternatives_1_1() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.roaster.model.source.JavaClassSource;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -76,6 +77,12 @@ public void setUp()
projectHelper.installCDI_1_0(project);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void checkCommandMetadata() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@

package org.jboss.forge.addon.javaee.cdi.ui;

import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.jboss.forge.addon.javaee.JavaEEPackageConstants.DEFAULT_CDI_PACKAGE;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import java.io.Serializable;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -42,6 +48,7 @@
import org.jboss.forge.roaster.model.JavaClass;
import org.jboss.forge.roaster.model.source.JavaAnnotationSource;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -84,6 +91,12 @@ public void setUp()
projectHelper.installCDI_1_0(project);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void checkCommandMetadata() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.roaster.model.JavaClass;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -82,6 +83,12 @@ public void setUp()
projectHelper.installCDI_1_0(project);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void checkCommandMetadata() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ public void setUp()
}

@After
public void tearDown()
public void tearDown() throws Exception
{
project.getRoot().delete(true);
shellTest.close();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.roaster.model.JavaAnnotation;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -82,6 +83,12 @@ public void setUp()
projectHelper.installCDI_1_0(project);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void checkCommandMetadata() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.roaster.model.JavaClass;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -84,6 +85,12 @@ public void setUp()
projectHelper.installCDI_1_0(project);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void checkCommandMetadata() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.roaster.model.JavaAnnotation;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -75,6 +76,12 @@ public void setUp()
projectHelper.installCDI_1_0(project);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void checkCommandMetadata() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.roaster.model.JavaAnnotation;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -82,6 +83,12 @@ public void setUp()
projectHelper.installCDI_1_0(project);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void checkCommandMetadata() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.roaster.model.JavaAnnotation;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -86,6 +87,12 @@ public void setUp()
projectHelper.installCDI_1_0(project);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void checkCommandMetadata() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.furnace.util.OperatingSystemUtils;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -60,6 +61,12 @@ public void clearScreen() throws Exception
shellTest.clearScreen();
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void testFacesFacetAvailability() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.roaster.model.JavaClass;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -85,6 +86,12 @@ public void setUp()
projectHelper.installCDI_1_0(project);
}

@After
public void tearDown() throws Exception
{
shellTest.close();
}

@Test
public void checkCommandMetadata() throws Exception
{
Expand Down Expand Up @@ -174,7 +181,7 @@ public void testCreateNewBeanRequestScoped() throws Exception
public void testCreateNewBeanSessionScoped() throws Exception
{
try (CommandController controller = uiTestHarness.createCommandController(FacesNewBeanCommand.class,
project.getRoot()))
project.getRoot()))
{
controller.initialize();
controller.setValueFor("named", "MyFacesBeanSession");
Expand Down
Loading

0 comments on commit f9c6a86

Please sign in to comment.