JavaJUnitTests.st
branchdirectory_structure_refactoring
changeset 1818 2e5ed72e7dfd
parent 1164 27524647d717
child 1953 1e42ad3fc322
equal deleted inserted replaced
1817:b86c40afbf1f 1818:2e5ed72e7dfd
       
     1 "
       
     2  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
     3 
       
     4  New code and modifications done at SWING Research Group [1]:
       
     5 
       
     6  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
       
     7                             SWING Research Group, Czech Technical University in Prague
       
     8 
       
     9  This software is furnished under a license and may be used
       
    10  only in accordance with the terms of that license and with the
       
    11  inclusion of the above copyright notice.   This software may not
       
    12  be provided or otherwise made available to, or used by, any
       
    13  other person.  No title to or ownership of the software is
       
    14  hereby transferred.
       
    15 
       
    16  [1] Code written at SWING Research Group contains a signature
       
    17      of one of the above copright owners. For exact set of such code,
       
    18      see the differences between this version and version stx:libjava
       
    19      as of 1.9.2010
       
    20 "
       
    21 "{ Package: 'stx:libjava' }"
       
    22 
       
    23 TestCase subclass:#JavaJUnitTests
       
    24 	instanceVariableNames:''
       
    25 	classVariableNames:''
       
    26 	poolDictionaries:''
       
    27 	category:'Languages-Java-Tests-Libraries'
       
    28 !
       
    29 
       
    30 !JavaJUnitTests class methodsFor:'documentation'!
       
    31 
       
    32 copyright
       
    33 "
       
    34  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
    35 
       
    36  New code and modifications done at SWING Research Group [1]:
       
    37 
       
    38  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
       
    39                             SWING Research Group, Czech Technical University in Prague
       
    40 
       
    41  This software is furnished under a license and may be used
       
    42  only in accordance with the terms of that license and with the
       
    43  inclusion of the above copyright notice.   This software may not
       
    44  be provided or otherwise made available to, or used by, any
       
    45  other person.  No title to or ownership of the software is
       
    46  hereby transferred.
       
    47 
       
    48  [1] Code written at SWING Research Group contains a signature
       
    49      of one of the above copright owners. For exact set of such code,
       
    50      see the differences between this version and version stx:libjava
       
    51      as of 1.9.2010
       
    52 
       
    53 "
       
    54 ! !
       
    55 
       
    56 !JavaJUnitTests class methodsFor:'resource'!
       
    57 
       
    58 resources
       
    59 
       
    60     ^ Array 
       
    61         with: JavaInitializedResource 
       
    62         with: JavaLibrariesResource
       
    63         with: JavaTestsResource
       
    64 
       
    65     "Created: / 28-02-2011 / 15:28:52 / Marcel Hlopko <hlopik@gmail.com>"
       
    66     "Modified: / 08-04-2011 / 17:03:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    67 ! !
       
    68 
       
    69 !JavaJUnitTests methodsFor:'running'!
       
    70 
       
    71 setUp
       
    72 
       
    73     super setUp.
       
    74     Java addToClassPath: '/usr/share/java/junit4.jar'.
       
    75 
       
    76     "Created: / 16-03-2011 / 15:28:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    77 ! !
       
    78 
       
    79 !JavaJUnitTests methodsFor:'tests - jUnit 3.x'!
       
    80 
       
    81 test_junit3x_01
       
    82     | runner  junit3testcase  result |
       
    83 
       
    84     "/ Java effectiveClassPath
       
    85     runner := Java classForName: 'org.junit.runner.JUnitCore'.
       
    86     self assert: runner notNil.
       
    87     junit3testcase := Java classForName: 'stx.libjava.tests.JUnit3Tests'.
       
    88     self assert: junit3testcase notNil.
       
    89      "signature: Result runClass(java.lang.Class[] classes)"
       
    90     result := runner 
       
    91                 perform: #'runClasses([Ljava/lang/Class;)Lorg/junit/runner/Result;'
       
    92                 with: (Array with: (JavaVM javaClassObjectForClass: junit3testcase)).
       
    93      "
       
    94      result getFailures
       
    95     "
       
    96     self assert: result getRunCount = 4.
       
    97     self assert: result getFailureCount = 2.
       
    98     self assert: result wasSuccessful not.
       
    99 
       
   100     "Created: / 06-02-2011 / 12:14:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   101     "Modified: / 07-04-2011 / 23:02:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   102     "Modified: / 09-10-2011 / 16:56:54 / m"
       
   103 ! !
       
   104 
       
   105 !JavaJUnitTests methodsFor:'tests - jUnit 4.x'!
       
   106 
       
   107 test_junit4x_01
       
   108     | runner  junit4testcase  result |
       
   109 
       
   110     "/ Java effectiveClassPath
       
   111     runner := Java classForName: 'org.junit.runner.JUnitCore'.
       
   112     self assert: runner notNil.
       
   113     junit4testcase := Java classForName: 'stx.libjava.tests.JUnit4Tests'.
       
   114     self assert: junit4testcase notNil.
       
   115      "signature: Result runClass(java.lang.Class[] classes)"
       
   116     result := runner 
       
   117                 perform: #'runClasses([Ljava/lang/Class;)Lorg/junit/runner/Result;'
       
   118                 with: (Array with: (JavaVM javaClassObjectForClass: junit4testcase)).
       
   119      "
       
   120      result getFailures
       
   121     "
       
   122     self assert: result getRunCount = 3.
       
   123     self assert: result getFailureCount = 1.
       
   124     self assert: result wasSuccessful not.
       
   125 
       
   126     "Created: / 06-02-2011 / 12:14:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   127     "Modified: / 28-02-2011 / 17:27:16 / Marcel Hlopko <hlopik@gmail.com>"
       
   128     "Modified: / 07-04-2011 / 23:02:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   129     "Modified: / 09-10-2011 / 16:57:01 / m"
       
   130 ! !
       
   131 
       
   132 !JavaJUnitTests class methodsFor:'documentation'!
       
   133 
       
   134 version_SVN
       
   135     ^ '$Id$'
       
   136 ! !