/** * @param testClass * The Test case {@link Class} * * @throws IllegalArgumentException * if testCase is null */ public ClassEvent(Class<?> testClass) { this(new TestClass(testClass)); }
/** * @param testClass * The Test case {@link Class} * * @throws IllegalArgumentException * if testCase is null */ public ClassEvent(Class<?> testClass) { this(new TestClass(testClass)); }
public Void call() throws Exception { generateDeploymentEvent.fire(new GenerateDeployment(new TestClass(deploymentClass))); suiteDeploymentScenario = classDeploymentScenario.get(); return null; } });
@Override public Void call() { generateDeploymentEvent.fire(new GenerateDeployment(new TestClass(deploymentClass))); suiteDeploymentScenario = classDeploymentScenario.get(); return null; } });
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionOnDeploymentWrongReturnType() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentWrongReturnType.class)); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionOnDeploymentNotStatic() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentNotStatic.class)); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionOnDeploymentWrongReturnType() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentWrongReturnType.class)); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionOnDeploymentNotStatic() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentNotStatic.class)); }
@Test public void shouldLogWarningForMismatchingArchiveTypeAndFileExtension() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentWithMismatchingTypeAndFileExtension.class)); String capturedLog = getTestCapturedLog(); Assert.assertTrue(capturedLog.contains(expectedLogPartForArchiveWithUnexpectedFileExtension)); }
@Test public void shouldGetDeploymentDescriptorFromSpi() { // given final AutomaticDeploymentScenarioGenerator automaticDeploymentScenarioGenerator = new AutomaticDeploymentScenarioGenerator(); automaticDeploymentScenarioGenerator.automaticDeploymentLocator = automaticDeploymentLocator; // when final List<DeploymentDescription> deploymentDescriptions = automaticDeploymentScenarioGenerator.generate(new TestClass(EmptyTest.class)); // then Assert.assertTrue(deploymentDescriptions.get(0).isArchiveDeployment()); }
@Test public void shouldLogWarningForDeploymentWithMissingFileExtension() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentWithMissingFileExtension.class)); String capturedLog = getTestCapturedLog(); Assert.assertTrue(capturedLog.contains(expectedLogPartForArchiveWithUnexpectedFileExtension)); }
@Test // should not log warning when using the default archive name public void shouldNotLogWarningForDeploymentWithoutSpecifiedName() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentWithoutSpecifiedName.class)); String capturedLog = getTestCapturedLog(); Assert.assertFalse(capturedLog.contains(expectedLogPartForArchiveWithUnexpectedFileExtension)); }
@Test public void shouldLogWarningForMismatchingArchiveTypeAndFileExtension() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentWithMismatchingTypeAndFileExtension.class)); String capturedLog = getTestCapturedLog(); Assert.assertTrue(capturedLog.contains(expectedLogPartForArchiveWithUnexpectedFileExtension)); }
@Test public void shouldLogWarningForDeploymentWithMissingFileExtension() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentWithMissingFileExtension.class)); String capturedLog = getTestCapturedLog(); Assert.assertTrue(capturedLog.contains(expectedLogPartForArchiveWithUnexpectedFileExtension)); }
@Test public void shouldNotLogWarningForMatchingArchiveTypeAndFileExtension() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentWithSpecifiedFileExtension.class)); String capturedLog = getTestCapturedLog(); Assert.assertFalse(capturedLog.contains(expectedLogPartForArchiveWithUnexpectedFileExtension)); }
@Test public void shouldNotLogWarningForMatchingArchiveTypeAndFileExtension() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentWithSpecifiedFileExtension.class)); String capturedLog = getTestCapturedLog(); Assert.assertFalse(capturedLog.contains(expectedLogPartForArchiveWithUnexpectedFileExtension)); }
@Test public void shouldGetDeploymentDescriptorFromSpi() { // given final AutomaticDeploymentScenarioGenerator automaticDeploymentScenarioGenerator = new AutomaticDeploymentScenarioGenerator(); automaticDeploymentScenarioGenerator.automaticDeploymentLocator = automaticDeploymentLocator; // when final List<DeploymentDescription> deploymentDescriptions = automaticDeploymentScenarioGenerator.generate(new TestClass(EmptyTest.class)); // then Assert.assertTrue(deploymentDescriptions.get(0).isArchiveDeployment()); }
@Test // should not log warning when using the default archive name public void shouldNotLogWarningForDeploymentWithoutSpecifiedName() throws Exception { new AnnotationDeploymentScenarioGenerator().generate( new TestClass(DeploymentWithoutSpecifiedName.class)); String capturedLog = getTestCapturedLog(); Assert.assertFalse(capturedLog.contains(expectedLogPartForArchiveWithUnexpectedFileExtension)); }
@Test public void shouldRunBeforeDeploymentMethods() { // given final AutomaticDeploymentScenarioGenerator automaticDeploymentScenarioGenerator = new AutomaticDeploymentScenarioGenerator(); automaticDeploymentScenarioGenerator.automaticDeploymentLocator = automaticDeploymentLocator; // when final List<DeploymentDescription> deploymentDescriptions = automaticDeploymentScenarioGenerator.generate(new TestClass(BeforeDeploymentTest.class)); // then Assert.assertTrue(deploymentDescriptions.get(0).isArchiveDeployment()); Assert.assertTrue(deploymentDescriptions.get(0).getArchive().contains("hello.txt")); }
@Test public void shouldRunBeforeDeploymentMethods() { // given final AutomaticDeploymentScenarioGenerator automaticDeploymentScenarioGenerator = new AutomaticDeploymentScenarioGenerator(); automaticDeploymentScenarioGenerator.automaticDeploymentLocator = automaticDeploymentLocator; // when final List<DeploymentDescription> deploymentDescriptions = automaticDeploymentScenarioGenerator.generate(new TestClass(BeforeDeploymentTest.class)); // then Assert.assertTrue(deploymentDescriptions.get(0).isArchiveDeployment()); Assert.assertTrue(deploymentDescriptions.get(0).getArchive().contains("hello.txt")); }