You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2009/09/22 17:04:16 UTC
svn commit: r817688 - in /jakarta/jmeter/trunk: lib/junit/ src/junit/test/
src/junit/woolfel/
Author: sebb
Date: Tue Sep 22 15:04:14 2009
New Revision: 817688
URL: http://svn.apache.org/viewvc?rev=817688&view=rev
Log:
More JUnit test cases
Added:
jakarta/jmeter/trunk/src/junit/test/AfterAnnotatedTest.java (with props)
jakarta/jmeter/trunk/src/junit/test/BeforeAnnotatedTest.java (with props)
jakarta/jmeter/trunk/src/junit/test/SetupTestError.java (with props)
jakarta/jmeter/trunk/src/junit/test/SetupTestFail.java (with props)
jakarta/jmeter/trunk/src/junit/test/TearDownTestFail.java (with props)
Modified:
jakarta/jmeter/trunk/lib/junit/test.jar
jakarta/jmeter/trunk/src/junit/test/DummyAnnotatedTest.java
jakarta/jmeter/trunk/src/junit/woolfel/DummyTestCase.java
Modified: jakarta/jmeter/trunk/lib/junit/test.jar
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/lib/junit/test.jar?rev=817688&r1=817687&r2=817688&view=diff
==============================================================================
Binary files - no diff available.
Added: jakarta/jmeter/trunk/src/junit/test/AfterAnnotatedTest.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/junit/test/AfterAnnotatedTest.java?rev=817688&view=auto
==============================================================================
--- jakarta/jmeter/trunk/src/junit/test/AfterAnnotatedTest.java (added)
+++ jakarta/jmeter/trunk/src/junit/test/AfterAnnotatedTest.java Tue Sep 22 15:04:14 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ */
+
+package test;
+
+import static org.junit.Assert.fail;
+import org.junit.After;
+import org.junit.Test;
+
+/**
+ * Test to demonstrate how @After failures are handled
+ */
+public class AfterAnnotatedTest {
+
+ @After
+ public void afterFail(){
+ fail("afterFail()");
+ }
+
+ @Test
+ public void afterTest(){
+ // Dummy to ensure there is a test to run
+ }
+}
Propchange: jakarta/jmeter/trunk/src/junit/test/AfterAnnotatedTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/trunk/src/junit/test/AfterAnnotatedTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: jakarta/jmeter/trunk/src/junit/test/BeforeAnnotatedTest.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/junit/test/BeforeAnnotatedTest.java?rev=817688&view=auto
==============================================================================
--- jakarta/jmeter/trunk/src/junit/test/BeforeAnnotatedTest.java (added)
+++ jakarta/jmeter/trunk/src/junit/test/BeforeAnnotatedTest.java Tue Sep 22 15:04:14 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ */
+
+package test;
+
+import static org.junit.Assert.fail;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test to demonstrate how @Before failures are handled
+ */
+public class BeforeAnnotatedTest {
+
+ @Before
+ public void beginFail(){
+ fail("beginFail()");
+ }
+
+ @Test
+ public void beginTest(){
+ // Dummy to ensure there is a test to run
+ }
+}
Propchange: jakarta/jmeter/trunk/src/junit/test/BeforeAnnotatedTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/trunk/src/junit/test/BeforeAnnotatedTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/trunk/src/junit/test/DummyAnnotatedTest.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/junit/test/DummyAnnotatedTest.java?rev=817688&r1=817687&r2=817688&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/junit/test/DummyAnnotatedTest.java (original)
+++ jakarta/jmeter/trunk/src/junit/test/DummyAnnotatedTest.java Tue Sep 22 15:04:14 2009
@@ -18,7 +18,9 @@
package test;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -29,15 +31,9 @@
*/
public class DummyAnnotatedTest
{
- public String name;
public int two = 1; //very wrong.
public DummyAnnotatedTest() {
- name="NOT SET";
- }
-
- public DummyAnnotatedTest(String name) {
- this.name = name;
}
// Generates expected Exception
@@ -100,4 +96,14 @@
@SuppressWarnings("unused")
int i = 27 / 0; // will generate Divide by zero error
}
+
+ @Test
+ public void stringCompareFail(){
+ assertEquals("this","that");
+ }
+
+ @Test
+ public void objectCompareFail(){
+ assertEquals(new Object(),new Object());
+ }
}
Added: jakarta/jmeter/trunk/src/junit/test/SetupTestError.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/junit/test/SetupTestError.java?rev=817688&view=auto
==============================================================================
--- jakarta/jmeter/trunk/src/junit/test/SetupTestError.java (added)
+++ jakarta/jmeter/trunk/src/junit/test/SetupTestError.java Tue Sep 22 15:04:14 2009
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ */
+
+package test;
+
+import junit.framework.TestCase;
+
+/**
+ * Test to demonstrate how setUp failures are handled
+ */
+public class SetupTestError extends TestCase {
+
+ @Override
+ public void setUp(){
+ throw new Error("setUp()");
+ }
+
+ public void testSetUpError(){
+ // Dummy to ensure there is a test to run
+ }
+}
Propchange: jakarta/jmeter/trunk/src/junit/test/SetupTestError.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/trunk/src/junit/test/SetupTestError.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: jakarta/jmeter/trunk/src/junit/test/SetupTestFail.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/junit/test/SetupTestFail.java?rev=817688&view=auto
==============================================================================
--- jakarta/jmeter/trunk/src/junit/test/SetupTestFail.java (added)
+++ jakarta/jmeter/trunk/src/junit/test/SetupTestFail.java Tue Sep 22 15:04:14 2009
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ */
+
+package test;
+
+import junit.framework.TestCase;
+
+/**
+ * Test to demonstrate how setUp failures are handled
+ */
+public class SetupTestFail extends TestCase {
+
+ @Override
+ public void setUp(){
+ fail("setUp()");
+ }
+
+ public void testSetUpFail(){
+ // Dummy to ensure there is a test to run
+ }
+}
Propchange: jakarta/jmeter/trunk/src/junit/test/SetupTestFail.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/trunk/src/junit/test/SetupTestFail.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: jakarta/jmeter/trunk/src/junit/test/TearDownTestFail.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/junit/test/TearDownTestFail.java?rev=817688&view=auto
==============================================================================
--- jakarta/jmeter/trunk/src/junit/test/TearDownTestFail.java (added)
+++ jakarta/jmeter/trunk/src/junit/test/TearDownTestFail.java Tue Sep 22 15:04:14 2009
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ */
+
+package test;
+
+import junit.framework.TestCase;
+
+/**
+ * Test to demonstrate how tearDown failures are handled
+ */
+public class TearDownTestFail extends TestCase {
+
+ @Override
+ public void tearDown(){
+ fail("tearDown()");
+ }
+
+ public void testTearDownFail(){
+ // Dummy to ensure there is a test to run
+ }
+}
Propchange: jakarta/jmeter/trunk/src/junit/test/TearDownTestFail.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/trunk/src/junit/test/TearDownTestFail.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/trunk/src/junit/woolfel/DummyTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/junit/woolfel/DummyTestCase.java?rev=817688&r1=817687&r2=817688&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/junit/woolfel/DummyTestCase.java (original)
+++ jakarta/jmeter/trunk/src/junit/woolfel/DummyTestCase.java Tue Sep 22 15:04:14 2009
@@ -88,4 +88,12 @@
@SuppressWarnings("unused")
int i = 27 / 0; // will generate Divide by zero error
}
+
+ public void testStringCompareFail(){
+ assertEquals("this","that");
+ }
+
+ public void testObjectCompareFail(){
+ assertEquals(new Object(),new Object());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org