JavaJUnitTests.st
changeset 2353 fa7400d022a0
parent 2152 1cbdfbcc685c
child 2380 9195eccdcbd9
child 2396 fadc6d7a2f5b
equal deleted inserted replaced
2352:ab9bb9d8ff4d 2353:fa7400d022a0
     1 "
     1 "
     2  COPYRIGHT (c) 1996-2011 by Claus Gittinger
     2  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
     3 
       
     4  New code and modifications done at SWING Research Group [1]:
       
     5 
     3  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
     6  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
     4                             SWING Research Group, Czech Technical University in Prague
     7                             SWING Research Group, Czech Technical University in Prague
     5 
       
     6  Parts of the code written by Claus Gittinger are under following
       
     7  license:
       
     8 
     8 
     9  This software is furnished under a license and may be used
     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
    10  only in accordance with the terms of that license and with the
    11  inclusion of the above copyright notice.   This software may not
    11  inclusion of the above copyright notice.   This software may not
    12  be provided or otherwise made available to, or used by, any
    12  be provided or otherwise made available to, or used by, any
    13  other person.  No title to or ownership of the software is
    13  other person.  No title to or ownership of the software is
    14  hereby transferred.
    14  hereby transferred.
    15 
    15 
    16  Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
    16  [1] Code written at SWING Research Group contains a signature
    17 
    17      of one of the above copright owners. For exact set of such code,
    18  Permission is hereby granted, free of charge, to any person
    18      see the differences between this version and version stx:libjava
    19  obtaining a copy of this software and associated documentation
    19      as of 1.9.2010
    20  files (the 'Software'), to deal in the Software without
       
    21  restriction, including without limitation the rights to use,
       
    22  copy, modify, merge, publish, distribute, sublicense, and/or sell
       
    23  copies of the Software, and to permit persons to whom the
       
    24  Software is furnished to do so, subject to the following
       
    25  conditions:
       
    26 
       
    27  The above copyright notice and this permission notice shall be
       
    28  included in all copies or substantial portions of the Software.
       
    29 
       
    30  THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
       
    31  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
       
    32  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
       
    33  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
       
    34  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
       
    35  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       
    36  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
       
    37  OTHER DEALINGS IN THE SOFTWARE.
       
    38 
       
    39  [1] Code written at SWING Research Group contain a signature
       
    40      of one of the above copright owners.
       
    41 "
    20 "
    42 "{ Package: 'stx:libjava' }"
    21 "{ Package: 'stx:libjava' }"
    43 
    22 
    44 TestCase subclass:#JavaJUnitTests
    23 TestCase subclass:#JavaJUnitTests
    45 	instanceVariableNames:''
    24 	instanceVariableNames:''
    46 	classVariableNames:''
    25 	classVariableNames:''
    47 	poolDictionaries:''
    26 	poolDictionaries:''
    48 	category:'Languages-Java-Tests'
    27 	category:'Languages-Java-Tests-Libraries'
    49 !
    28 !
    50 
    29 
    51 !JavaJUnitTests class methodsFor:'documentation'!
    30 !JavaJUnitTests class methodsFor:'documentation'!
    52 
    31 
    53 copyright
    32 copyright
    54 "
    33 "
    55  COPYRIGHT (c) 1996-2011 by Claus Gittinger
    34  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
    35 
       
    36  New code and modifications done at SWING Research Group [1]:
       
    37 
    56  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
    38  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
    57                             SWING Research Group, Czech Technical University in Prague
    39                             SWING Research Group, Czech Technical University in Prague
    58 
       
    59  Parts of the code written by Claus Gittinger are under following
       
    60  license:
       
    61 
    40 
    62  This software is furnished under a license and may be used
    41  This software is furnished under a license and may be used
    63  only in accordance with the terms of that license and with the
    42  only in accordance with the terms of that license and with the
    64  inclusion of the above copyright notice.   This software may not
    43  inclusion of the above copyright notice.   This software may not
    65  be provided or otherwise made available to, or used by, any
    44  be provided or otherwise made available to, or used by, any
    66  other person.  No title to or ownership of the software is
    45  other person.  No title to or ownership of the software is
    67  hereby transferred.
    46  hereby transferred.
    68 
    47 
    69  Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
    48  [1] Code written at SWING Research Group contains a signature
    70 
    49      of one of the above copright owners. For exact set of such code,
    71  Permission is hereby granted, free of charge, to any person
    50      see the differences between this version and version stx:libjava
    72  obtaining a copy of this software and associated documentation
    51      as of 1.9.2010
    73  files (the 'Software'), to deal in the Software without
       
    74  restriction, including without limitation the rights to use,
       
    75  copy, modify, merge, publish, distribute, sublicense, and/or sell
       
    76  copies of the Software, and to permit persons to whom the
       
    77  Software is furnished to do so, subject to the following
       
    78  conditions:
       
    79 
       
    80  The above copyright notice and this permission notice shall be
       
    81  included in all copies or substantial portions of the Software.
       
    82 
       
    83  THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
       
    84  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
       
    85  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
       
    86  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
       
    87  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
       
    88  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       
    89  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
       
    90  OTHER DEALINGS IN THE SOFTWARE.
       
    91 
       
    92  [1] Code written at SWING Research Group contain a signature
       
    93      of one of the above copright owners.
       
    94 
       
    95 "
       
    96 !
       
    97 
       
    98 documentation
       
    99 "
       
   100     A test case that tests whether JUnit 3.x works under
       
   101     stx:libjava.
       
   102 
       
   103     [author:]
       
   104         Jan Vrany <jan.vrany@fit.cvut.cz>
       
   105 
       
   106     [instance variables:]
       
   107 
       
   108     [class variables:]
       
   109 
       
   110     [see also:]
       
   111 
    52 
   112 "
    53 "
   113 ! !
    54 ! !
   114 
    55 
   115 !JavaJUnitTests class methodsFor:'resource'!
    56 !JavaJUnitTests class methodsFor:'resource'!
   136 ! !
    77 ! !
   137 
    78 
   138 !JavaJUnitTests methodsFor:'tests - jUnit 3.x'!
    79 !JavaJUnitTests methodsFor:'tests - jUnit 3.x'!
   139 
    80 
   140 test_junit3x_01
    81 test_junit3x_01
       
    82     | runner  junit3testcase  result |
   141 
    83 
   142     | runner junit3testcase result |
       
   143     "/ Java effectiveClassPath
    84     "/ Java effectiveClassPath
   144 
       
   145     runner := Java classForName: 'org.junit.runner.JUnitCore'.
    85     runner := Java classForName: 'org.junit.runner.JUnitCore'.
   146     self assert: runner notNil.
    86     self assert: runner notNil.
   147     junit3testcase := Java classForName: 'stx.libjava.tests.JUnit3Tests'.
    87     junit3testcase := Java classForName: 'stx.libjava.tests.JUnit3Tests'.
   148     self assert: junit3testcase notNil.
    88     self assert: junit3testcase notNil.
   149 
    89      "signature: Result runClass(java.lang.Class[] classes)"
   150     "signature: Result runClass(java.lang.Class[] classes)"
       
   151     result := runner 
    90     result := runner 
   152                 perform:#'runClasses([Ljava/lang/Class;)Lorg/junit/runner/Result;' 
    91                 perform: #'runClasses([Ljava/lang/Class;)Lorg/junit/runner/Result;'
   153                 with: (Array with: (JavaVM javaClassObjectForClass: junit3testcase)).
    92                 with: (Array with: (JavaVM javaClassObjectForClass: junit3testcase)).
   154 
    93      "
   155     "
    94      result getFailures
   156     result getFailures
       
   157     "
    95     "
   158     self assert: result getRunCount = 4.
    96     self assert: result getRunCount = 4.
   159     self assert: result getFailureCount = 2.
    97     self assert: result getFailureCount = 2.
   160     self assert: result wasSuccessful == 0"false"
    98     self assert: result wasSuccessful not.
   161 
    99 
   162     "Created: / 06-02-2011 / 12:14:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   100     "Created: / 06-02-2011 / 12:14:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   163     "Modified: / 07-04-2011 / 23:02:40 / 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"
   164 ! !
   103 ! !
   165 
   104 
   166 !JavaJUnitTests methodsFor:'tests - jUnit 4.x'!
   105 !JavaJUnitTests methodsFor:'tests - jUnit 4.x'!
   167 
   106 
   168 test_junit4x_01
   107 test_junit4x_01
   169     | runner  junit4testcase  result |
   108     | runner  junit4testcase  result |
   170 
   109 
   171     "/ Java effectiveClassPath
   110     "/ Java effectiveClassPath
   172     
   111     runner := Java classForName: 'org.junit.runner.JUnitCore'.
   173     runner := Java classForName:'org.junit.runner.JUnitCore'.
   112     self assert: runner notNil.
   174     self assert:runner notNil.
   113     junit4testcase := Java classForName: 'stx.libjava.tests.JUnit4Tests'.
   175     junit4testcase := Java classForName:'stx.libjava.tests.JUnit4Tests'.
   114     self assert: junit4testcase notNil.
   176     self assert:junit4testcase notNil.
       
   177      "signature: Result runClass(java.lang.Class[] classes)"
   115      "signature: Result runClass(java.lang.Class[] classes)"
   178     result := runner 
   116     result := runner 
   179                 perform:#'runClasses([Ljava/lang/Class;)Lorg/junit/runner/Result;'
   117                 perform: #'runClasses([Ljava/lang/Class;)Lorg/junit/runner/Result;'
   180                 with:(Array with:(JavaVM javaClassObjectForClass:junit4testcase)).
   118                 with: (Array with: (JavaVM javaClassObjectForClass: junit4testcase)).
   181      "
   119      "
   182      result getFailures
   120      result getFailures
   183     "
   121     "
   184     self assert:result getRunCount = 3.
   122     self assert: result getRunCount = 3.
   185     self assert:result getFailureCount = 1.
   123     self assert: result getFailureCount = 1.
   186     self assert:result wasSuccessful == 0
   124     self assert: result wasSuccessful not.
   187 
   125 
   188     "Created: / 06-02-2011 / 12:14:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   126     "Created: / 06-02-2011 / 12:14:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   189     "Modified: / 28-02-2011 / 17:27:16 / Marcel Hlopko <hlopik@gmail.com>"
   127     "Modified: / 28-02-2011 / 17:27:16 / Marcel Hlopko <hlopik@gmail.com>"
   190     "Modified: / 07-04-2011 / 23:02:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   128     "Modified: / 07-04-2011 / 23:02:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   129     "Modified: / 09-10-2011 / 16:57:01 / m"
   191 ! !
   130 ! !
   192 
   131 
   193 !JavaJUnitTests class methodsFor:'documentation'!
   132 !JavaJUnitTests class methodsFor:'documentation'!
   194 
   133 
       
   134 version_CVS
       
   135     ^ '$Header: /cvs/stx/stx/libjava/JavaJUnitTests.st,v 1.2 2013-02-16 18:08:32 vrany Exp $'
       
   136 !
       
   137 
       
   138 version_HG
       
   139 
       
   140     ^ '$Changeset: <not expanded> $'
       
   141 !
       
   142 
   195 version_SVN
   143 version_SVN
   196     ^ '$Id: JavaJUnitTests.st,v 1.1 2011-08-18 19:06:53 vrany Exp $'
   144     ^ '§Id§'
   197 ! !
   145 ! !
       
   146