Permalink
Browse files

FLEXMOJOS-395 - Add IT for it

  • Loading branch information...
1 parent 164b3b3 commit 06fb69e2c63497d122a9b0d677eee9d202126ef5 @velo velo committed Aug 30, 2011
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+
+ Copyright 2008 Marvin Herman Froeder Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
+ governing permissions and limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.sonatype.flexmojos</groupId>
+ <artifactId>flexmojos-flex-super-pom</artifactId>
+ <version>%{flexmojos.version}</version>
+ </parent>
+
+ <groupId>info.rvin.itest</groupId>
+ <artifactId>flexunit4</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <packaging>swc</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.flexmojos</groupId>
+ <artifactId>flexmojos-maven-plugin</artifactId>
+ <version>%{flexmojos.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <localesCompiled>
+ <locale>en_US</locale>
+ </localesCompiled>
+ <localesRuntime>
+ <locale>es_MX,es_ES,en_US</locale>
+ </localesRuntime>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>com.adobe.flexunit</groupId>
+ <artifactId>flexunit</artifactId>
+ <version>4.0-beta-2</version>
+ <type>swc</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Copyright 2008 Marvin Herman Froeder
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
+
+ <mx:Script>
+ <![CDATA[
+
+ import org.sonatype.flexmojos.l10n.Resource;
+
+ [Bindable]
+ private var resource:Resource = new Resource();
+
+ ]]>
+ </mx:Script>
+
+ <mx:Label text="{resource.title}" />
+</mx:Application>
@@ -0,0 +1,18 @@
+package org.sonatype.flexmojos.l10n
+{
+ import mx.resources.ResourceManager;
+
+ [ResourceBundle("text")]
+ public class Resource
+ {
+
+ [Bindable]
+ public var title:String;
+
+ public function Resource()
+ {
+ title = ResourceManager.getInstance().getString("text", "TITLE");
+ }
+
+ }
+}
@@ -0,0 +1,18 @@
+/**
+ * @author Seven
+ */
+package {
+
+ import flexunit.framework.Assert;
+ import org.sonatype.flexmojos.l10n.Resource;
+
+ public class AnnotatedTest {
+
+ [Test]
+ public function addition():void {
+ Assert.assertNotNull(new Resource().title);
+ }
+
+ }
+
+}
@@ -0,0 +1,41 @@
+package org.sonatype.flexmojos.tests.issues;
+
+import java.io.File;
+import java.io.FileReader;
+import java.util.Arrays;
+
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+import org.sonatype.flexmojos.test.FMVerifier;
+import org.sonatype.flexmojos.test.report.TestCaseReport;
+import org.testng.AssertJUnit;
+import org.testng.annotations.Test;
+
+public class Flexmojos395Test
+ extends AbstractIssueTest
+{
+
+ @Test
+ public void testFlexUnit4Example()
+ throws Exception
+ {
+ FMVerifier v = testIssue( "flexmojos-395" );
+ File testDir = new File(v.getBasedir());
+
+ File target = new File( testDir, "target" );
+ File sureFireReports = new File( target, "surefire-reports" );
+ AssertJUnit.assertTrue( "Report folder not created!", sureFireReports.isDirectory() );
+
+ String[] reportFiles = sureFireReports.list();
+ AssertJUnit.assertEquals( "Expected for 1 files, got: " + Arrays.toString( reportFiles ), 1, reportFiles.length );
+
+ File reportFile = new File( sureFireReports, "TEST-AnnotatedTest.addition.AnnotatedTest.xml" );
+ AssertJUnit.assertTrue( "Report was not created!", reportFile.isFile() );
+
+ TestCaseReport report = new TestCaseReport( Xpp3DomBuilder.build( new FileReader( reportFile ) ) );
+
+ AssertJUnit.assertEquals( 0, report.getErrors() );
+ AssertJUnit.assertEquals( 0, report.getFailures() );
+ AssertJUnit.assertEquals( 1, report.getTests() );
+ }
+
+}

0 comments on commit 06fb69e

Please sign in to comment.