Re: Custom classloader

"Bill Shannon [email protected] [junit]" <[email protected]> Tue, 19 May 2015 13:53:13 -0700
Newsgroups gmane.comp.java.junit.user
Message-ID <[email protected]>
--------------030104020703020903000406
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

I created a ClassLoaderSuite
<https://java.net/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java>
to do this for JavaMail testing several years ago.

David Saff [email protected] [junit] wrote on 05/19/15 11:01:
>  
> You should be able to do it with a custom Runner.  As Aaron pointed out,
> Robolectric does it, and I'd definitely recommend poking around their code a
> bit.  I don't think any patches to JUnit should be necessary.
>
> On Tue, May 19, 2015 at 7:11 AM, Malte Finsterwalder [email protected]
> <mailto:[email protected]> [junit] <[email protected]
> <mailto:[email protected]>> wrote:
>
>      
>     Hi Johannes,
>
>     I'm totally on Dawids side: Why do you need custom classloading?
>     On the other hand, if you really, really need it, you may be able to
>     realize it by wrapping surefire or JUnit (or both) somehow. And there is
>     always bytecode-manipulation. :-)
>     But then again: JUnit is no magic. You could even write your own very
>     simple test execution framework for your particular problem. And you could
>     even base it on JUnits capabilities.
>     Just to spray some more ideas...
>
>     Greetings,
>        Malte
>
>
> 


--------------030104020703020903000406
Content-Type: text/html; charset=ISO-8859-1
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>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">


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

<br><br>

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



    I created a <a
href="https://java.net/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java">ClassLoaderSuite</a>
    to do this for JavaMail testing several years ago.<br>
    <br>
    David Saff <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a> [junit] wrote on 05/19/15 11:01:
    <blockquote
cite="mid:CALrw-PxDQ7Ef63yrWU_+6ftaCfAhFYwZaBjsqPNxX1eUj8WzQw@mail.gmail.com"
      type="cite"> <span style="display:none">&nbsp;</span>
      
          <div id="ygrp-text">
            <div dir="ltr">You should be able to do it with a custom
              Runner.&nbsp; As Aaron pointed out, Robolectric does it, and
              I'd definitely recommend poking around their code a bit.&nbsp;
              I don't think any patches to JUnit should be necessary.</div>
            <div class="gmail_extra"><br>
              <div class="gmail_quote">On Tue, May 19, 2015 at 7:11 AM,
                Malte Finsterwalder <a moz-do-not-send="true"
                  href="mailto:[email protected]">[email protected]</a>
                [junit] <span dir="ltr">&lt;<a moz-do-not-send="true"
                    href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;</span>
                wrote:<br>
                <blockquote class="gmail_quote" style="border-left:1px
                  #ccc solid;">
                  <div style="background-color:#fff;">
                    <span>&nbsp;</span>
                    <div>
                      <div>
                        <div>
                          <div dir="ltr">Hi Johannes,
                            <div><br>
                            </div>
                            <div>I'm totally on Dawids side: Why do you
                              need custom classloading?</div>
                            <div>On the other hand, if you really,
                              really need it, you may be able to realize
                              it by wrapping surefire or JUnit (or both)
                              somehow. And there is always
                              bytecode-manipulation. :-)</div>
                            <div>But then again: JUnit is no magic. You
                              could even write your own very simple test
                              execution framework for your particular
                              problem. And you could even base it on
                              JUnits capabilities.</div>
                            <div>Just to spray some more ideas...</div>
                            <div><br>
                            </div>
                            <div>Greetings,</div>
                            <div>&nbsp; &nbsp;Malte</div>
                            &#8203;</div>
                        </div>
                      </div>
                    </div>
                  </div>
                </blockquote>
              </div>
              <br>
            </div>
          </div>
          
      
      <!-- end group email -->
    </blockquote>
    <br>
  



<!-- |**|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: Bill Shannon &lt;[email protected]&gt;         <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=24661/stime=1432069146" 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=X3oDMTJlYjI2MGN0BF9TAzk3MzU5NzE0BGdycElkAzI0MjMzMjgEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQzMjA2OTE0Ng--" 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=X3oDMTJmN3FoYXVoBF9TAzk3MzU5NzE0BGdycElkAzI0MjMzMjgEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzE0MzIwNjkxNDY-" style="text-decoration: none;">New Members</a></span>
      <span class="ct" style="color: #ff7900;">4</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=X3oDMTJkamFoZDUxBF9TAzk3NDc2NTkwBGdycElkAzI0MjMzMjgEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDMyMDY5MTQ2" 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>

--------------030104020703020903000406--