In th e next version of the junit could you add suport to inject junit test in one junit test class ? this will improve tests and give support to reuse junit test in anothers junit test, avoiding duplicate code..

"[email protected] [junit]" <[email protected]> 28 Jan 2016 06:33:07 -0800
Newsgroups gmane.comp.java.junit.user
Message-ID <[email protected]>
--9nlWnTS9ocNmxdhsK3FKVLWiM6a5jwOaA8HvrLV
Content-Type:  text/plain;  charset=utf-8 
Content-Transfer-Encoding: base64

SW4gdGggZSBuZXh0IHZlcnNpb24gb2YgdGhlIGp1bml0IGNvdWxkIHlvdSBhZGQgc3Vwb3J0
IHRvIGluamVjdCBqdW5pdCB0ZXN0IGluIG9uZSBqdW5pdCB0ZXN0IGNsYXNzID8gdGhpcyB3
aWxsIGltcHJvdmUgdGVzdHMgYW5kIGdpdmUgc3VwcG9ydCB0byByZXVzZSBqdW5pdCB0ZXN0
IGluIGFub3RoZXJzIGp1bml0IHRlc3QsIGF2b2lkaW5nIGR1cGxpY2F0ZSBjb2RlLi4NCg0K
DQpAUnVuV2l0aCggU3ByaW5nSlVuaXQ0Q2xhc3NSdW5uZXIuY2xhc3MgKQ0KQENvbnRleHRD
b25maWd1cmF0aW9uKCBsb2NhdGlvbnMgPSB7ICIvQXBwbGljYXRpb25Db250ZXh0LnhtbCIg
fSApDQpAUm9sbGJhY2soIHZhbHVlID0gdHJ1ZSApDQpAVHJhbnNhY3Rpb25hbA0KcHVibGlj
IGNsYXNzIFNlcnZpY2VCdXNpbmVzc1Rlc3Qgew0KDQogICBAQXV0b3dpcmVkDQogICAgcHJp
dmF0ZSBTZXJ2aWNlQnVzaW5lc3Mgc2VydmljZUJ1c2luZXNzOw0KDQogIEBBdXRvd2lyZWQN
CiAgICBwcml2YXRlIEFncmVlbWVudEJ1c2luZXNzVGVzdCBhZ3JlZW1lbnRCdXNpbmVzczsN
Cg0KDQpAVGVzdA0KICAgIHB1YmxpYyBPYmplY3Qgc2F2ZU9yVXBkYXRlKCkgew0KICAgICAg
ICBTZXJ2aWNlVE8gc2VydmljZVRPID0gU2V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ZXN0DQogICAgcHVibGljIHZvaWQg
ZmluZEFsbCgpIHsNCiAgICAgICAgdHJ5IHsNCiAgICAgICAgICAgIEBTdXBwcmVzc1dhcm5p
bmdzKCAidW51c2VkIiApDQogICAgICAgICAgICBMaXN0PCBBZ3JlZW1lbnRUTyA+IGFncmVl
bWVudFRPcyA9IGFncmVlbWVudEJ1c2luZXNzLmZpbmRBbGwoKTsNCg0KICAgICAgICB9IGNh
dGNoICggQ1NNQnVzaW5lc3NFeGNlcHRpb24gZSApIHsNCiAgICAgICAgICAgIHRocm93IG5l
dyBBc3NlcnRpb25FcnJvcigpOw0KICAgICAgICB9DQogICAgfQ0KDQogICAgQFRlc3QNCiAg
ICBwdWJsaWMgT2JqZWN0IHNhdmVPclVwZGF0ZSgpIHsNCiAgICAgICAgQWdyZWVtZW50VE8g
YWdyZWVtZW50VE8gPSBBZ3JlZW1lbnRUTy5idWlsZEFncmVlbWVudFRPKCk7DQoNCiAgICAg
ICAgdHJ5IHsNCiAgICAgICAgICAgIC8vIGEgbG90IG9mIHNhdmluZyBkZXBlbmRlbmNpZXMg
b2YgYWdyZWVtZW50IA0KICAgICAgICAgICAgYWdyZWVtZW50VE8gPSBhZ3JlZW1lbnRCdXNp
bmVzcy5zYXZlT3JVcGRhdGUoIGFncmVlbWVudFRPICk7DQogICAgICAgIH0gY2F0Y2ggKCBW
YWxpZGF0aW9uRXhjZXB0aW9uIHwgQ1NNQnVzaW5lc3NFeGNlcHRpb24gZSApIHsNCiAgICAg
ICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbiggZS5nZXRNZXNzYWdlKCkgKTsNCiAgICAgICAg
ICAgIHRocm93IG5ldyBBc3NlcnRpb25FcnJvcigpOw0KICAgICAgICB9DQogICAgICAgIHJl
dHVybiBhZ3JlZW1lbnRUTzsNCiAgICB9DQoNCn0NCg0KVGhhbmtzLg==

--9nlWnTS9ocNmxdhsK3FKVLWiM6a5jwOaA8HvrLV
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit





<head>

<style type="text/css">
<!--

/* start of attachment style */
       .ygrp-photo-title{
         clear: both;
         font-size: smaller;
         height: 15px;
         overflow: hidden;
         text-align: center;
         width: 75px;
       }
       div.ygrp-photo{
         background-position: center;
         background-repeat: no-repeat;
         background-color: white;
         border: 1px solid black;
         height: 62px;
         width: 62px;
       }

       div.photo-title 
         a,
         div.photo-title a:active,
         div.photo-title a:hover,
         div.photo-title a:visited {
           text-decoration: none; 
       }

       div.attach-table div.attach-row {
         clear: both;
       }

       div.attach-table div.attach-row div {
         float: left;
         /* margin: 2px;*/
       }

       p {
         clear: both;
         padding: 15px 0 3px 0;
	 overflow: hidden;
       }

       div.ygrp-file {
         width: 30px;
         valign: middle;
       }
       div.attach-table div.attach-row div div a {
         text-decoration: none;
       }

       div.attach-table div.attach-row div div span {
         font-weight: normal;
       }

       div.ygrp-file-title {
         font-weight: bold;
       }
 /* end of attachment style */
        -->
        </style>
        </head>
<html>
<head>
<style type="text/css">
<!--
#ygrp-mkp {
  border: 1px solid #d8d8d8;
  font-family: Arial;
  margin: 10px 0;
  padding: 0 10px;
}

#ygrp-mkp hr {
  border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
  color: #628c2a;
  font-size: 85%;
  font-weight: 700;
  line-height: 122%;
  margin: 10px 0;
}

#ygrp-mkp #ads {
  margin-bottom: 10px;
}

#ygrp-mkp .ad {
  padding: 0 0;
}

#ygrp-mkp .ad p {
  margin: 0;
}

#ygrp-mkp .ad a {
  color: #0000ff;
  text-decoration: none;
}
-->
</style>
</head>
<body>



<!-- |**|begin egp html banner|**| -->

<br><br>

<!-- |**|end egp html banner|**| -->


In th e next version of the junit could you add suport to inject junit test in one junit test class ? this will improve tests and give support to reuse junit test in anothers junit test, avoiding duplicate code..<br><br><br>@RunWith( SpringJUnit4ClassRunner.class )<br>@ContextConfiguration( locations = { &quot;/ApplicationContext.xml&quot; } )<br>@Rollback( value = true )<br>@Transactional<br>public class ServiceBusinessTest {<br><br>&nbsp;&nbsp; @Autowired<br>&nbsp;&nbsp;&nbsp; private ServiceBusiness serviceBusiness;<br><br>&nbsp; @Autowired<br>&nbsp;&nbsp;&nbsp; private AgreementBusinessTest agreementBusiness;<br><br><br>@Test<br>&nbsp;&nbsp;&nbsp; public Object saveOrUpdate() {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ServiceTO serviceTO = ServiceTO.buildServiceTO();<br>&nbsp;&nbsp;&nb
 sp; &nbsp;&nbsp;&nbsp; AgreementTO agreementTO = AgreementBusinessTest.buildAgreementTO();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br>&nbsp;&nbsp;&nbsp;&nbsp; <span class="tab">&nbsp; &nbsp; &nbsp; serviceTO.setAgreementTO( (</span><span class="tab">AgreementTO) agreementBusiness.saveOrUpdate() ); &nbsp;&nbsp; </span><br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; serviceTO = serviceBusiness.saveOrUpdate( serviceTO );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch ( ValidationException | CSMBusinessException e ) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println( e.getMessage() );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new AssertionError();<br>&nbsp;&n
 bsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><span class="tab">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return </span>serviceTO;<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br><br>@RunWith( SpringJUnit4ClassRunner.class )<br>@ContextConfiguration( locations = { &quot;/ApplicationContext.xml&quot; } )<br>@Rollback( value = true )<br>@Transactional<br>public class AgreementBusinessTest {<br><br>&nbsp;&nbsp;&nbsp; @Autowired<br>&nbsp;&nbsp;&nbsp; private AgreementBusiness agreementBusiness;<br><br>&nbsp;&nbsp; // alot of injections of business <br>&nbsp; <br>&nbsp;&nbsp;&nbsp; @Test<br>&nbsp;&nbsp;&nbsp; public void findAll() {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; @SuppressWarnings( &quot;unused&quot; )<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nb
 sp; &nbsp;&nbsp;&nbsp; List&lt; AgreementTO &gt; agreementTOs = agreementBusiness.findAll();<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch ( CSMBusinessException e ) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new AssertionError();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; @Test<br>&nbsp;&nbsp;&nbsp; public Object saveOrUpdate() {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; AgreementTO agreementTO = AgreementTO.buildAgreementTO();<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // a lot of saving dependencies of agreement <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; agreementTO = agreementBusiness.saveOrUpdate( agreementTO
  );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch ( ValidationException | CSMBusinessException e ) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println( e.getMessage() );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new AssertionError();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><span class="tab">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return </span>agreementTO;<br>&nbsp;&nbsp;&nbsp; }<br><br>}<br><br>Thanks.



<!-- |**|begin egp html banner|**| -->

<br>


<br>

<!-- |**|end egp html banner|**| -->


<div width="1" style="color: white; clear: both;"/>__._,_.___</div>

      
  

    
    <div id="fromDMARC" style="clear:both; margin-top: 10px;">
         <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
         Posted by: [email protected]         <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
    </div>
<!-- Start Recommendations -->
<!-- End Recommendations -->



<!-- |**|begin egp html banner|**| -->

  <img src="http://geo.yahoo.com/serv?s=97476590/grpId=2423328/grpspId=1705006905/msgId=24740/stime=1454086071" width="1" height="1"> <br>

<!-- |**|end egp html banner|**| -->

  
<!-- |**|begin egp html banner|**| -->

<br>



   
     
 
        <!-- |**|begin egp html banner|**| -->
        <div id="ygrp-vital" style="background-color: #f2f2f2; font-family: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

        <span id="vithd" style="font-weight: bold; color: #333; text-transform: uppercase; "><a href="https://groups.yahoo.com/neo/groups/junit/info;_ylc=X3oDMTJlb3RqcWgxBF9TAzk3MzU5NzE0BGdycElkAzI0MjMzMjgEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ1NDA4NjA3MQ--" style="text-decoration: none;">Visit Your Group</a></span>

     <ul style="list-style-type: none; margin: 0; padding: 0; display: inline;">
            <li style="border-right: 1px solid #000; font-weight: 700; display: inline; padding: 0 5px; margin-left: 0;">
      <span class="cat"><a href="https://groups.yahoo.com/neo/groups/junit/members/all;_ylc=X3oDMTJmcXBxZmowBF9TAzk3MzU5NzE0BGdycElkAzI0MjMzMjgEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzE0NTQwODYwNzE-" style="text-decoration: none;">New Members</a></span>
      <span class="ct" style="color: #ff7900;">2</span>
    </li>
                                              </ul>
  </div>


<div id="ft" style="font-family: Arial; font-size: 11px; margin-top: 5px; padding: 0 2px 0 0; clear: both;">
  <a href="https://groups.yahoo.com/neo;_ylc=X3oDMTJkc25kb2hqBF9TAzk3NDc2NTkwBGdycElkAzI0MjMzMjgEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDU0MDg2MDcx" style="float: left;"><img src="http://l.yimg.com/ru/static/images/yg/img/email/new_logo/logo-groups-137x15.png" height="15" width="137" alt="Yahoo! Groups" style="border: 0;"/></a>
  <div style="color: #747575; float: right;"> &bull; <a href="https://info.yahoo.com/privacy/us/yahoo/groups/details.html" style="text-decoration: none;">Privacy</a> &bull; <a href="mailto:[email protected]?subject=Unsubscribe" style="text-decoration: none;">Unsubscribe</a> &bull; <a href="https://info.yahoo.com/legal/us/yahoo/utos/terms/" style="text-decoration: none;">Terms of Use</a> </div>
</div>

<!-- |**|end egp html banner|**| -->

  </div> <!-- ygrp-msg -->

   


  <br>

<!-- |**|end egp html banner|**| -->


<div style="color: white; clear: both;"/>__,_._,___</div>
</body>

</html>

--9nlWnTS9ocNmxdhsK3FKVLWiM6a5jwOaA8HvrLV--