You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/10/09 11:00:15 UTC

DO NOT REPLY [Bug 40708] New: - Running JUnit 4 tests with AspectJ and fork=No causes exception

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40708>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40708

           Summary: Running JUnit 4 tests with AspectJ and fork=No causes
                    exception
           Product: Ant
           Version: 1.7.0Beta2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: mirko.zieroth@nuernberger.de


The classes to be tested are Singletons written with AspectJ and Java 1.5. The
test-classes are pure Junit 4 tests with anotations and without JUnit4TestAdapter.

If I run the ant script with fork="no" I get the exception: "No runnable methods".
But if I run the ant script with the attribute fork="yes" the junit testcase can
be executed and I get an "AssertionFailedError".

Here is the junit task of my ant-script:

<junit printsummary="on" haltonerror="off"  >
	<formatter type="xml" />
	<classpath>
	 <pathelement path="${classes.dir}" />
		<pathelement path="${test.classes.dir}" />
		<pathelement path="${ant.home}/lib/" />
	</classpath>
	<classpath refid="project.classpath" />

	<batchtest fork="no" todir="${test.report.dir}" >
		<fileset dir="${test.source.dir}">
			<include name="**/*Test*.java" />
			<exclude name="**/*Mock*.java" />
		</fileset>
	</batchtest>
</junit>


Here is the test-case:

public class SingletonTest
{
  @Test 
  public void createSingleton()
  {
    TestMock1 s1 = new TestMock1();
    TestMock1 s2 = new TestMock1();
    
    assertEquals(s1, s2);
    assertTrue(s1.getInvocationTime() == s2.getInvocationTime());
    
    TestMock2 s3 = new TestMock2();
    TestMock2 s4 = new TestMock2();
    
    assertEquals(s3, s4);
    assertTrue(s3.getInvocationTime() == s4.getInvocationTime());
    assertNotSame(s1, s3);
  }
}

and one mock object representatively for the other:

@Singleton
public class TestMock1
{
  protected Long invocationTime = System.currentTimeMillis();
  
  /**
   * R&#65533;ckgabe der Instanziierungszeit
   * @return long - Timestamp
   */
  public Long getInvocationTime()
  {
    return invocationTime; 
  }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 40708] - Running JUnit 4 tests with AspectJ and fork=No causes exception

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40708>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40708


peterreilly@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE




------- Additional Comments From peterreilly@apache.org  2006-10-09 02:16 -------
This should be fixed with the current nightly build.

*** This bug has been marked as a duplicate of 40697 ***

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org