classpath - java - Change classloader for a given class -
so resource reading in project done so:
someloadingclass.class.getresource(resource);
for test, i'd hook different config file use. safety net config file has right stuff in it.
given i'm writing test in test class a
, , above code snippet happens somewhere else, how can - add together new file classpath (presumably class someloadingclass
) config file want used, not 1 set in .classpath
file.
i'd prefer able "overwrite" existing config file, instead of blowing away entire contents of .classpath
- possible? if so, how?
apologies - i've read few of classpath entries here don't seem quite want. (they're overwriting current thread's classloader, doesn't seem appropriate here - i.e. not work)
edit one test shimmy classpath. that's it, nil more. don't want alter every other test. also, no maven beingness used.
if using maven, believe set test config file in src/test/resources dir same name , override real config file @ test time.
java classpath
No comments:
Post a Comment