我正在开发一个Java Api来做事情(秘密,呃嗯;).
有没有办法隐藏类,以及我的API的内部结构?
---
package net.my.app;
//this is the Public Access
class MyPublicClass{
public void somePublicFunction(){
//access to not visibil classes
}
}
---
package net.my.app.notvisible:
//this is what i want to hide
class MyNOTPublicClass{
...
}
---
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?谢谢!
在我的测试中非常奇怪的行为.
public class MyTestclass {
@Before
void setUp(){
//do some setup, but hu i get called twice
//here i do some try catch thing to get the stacktrace...
}
void testOnlyOneTest(){
//make the testing, i get called only once
}
@After
void tearDown(){
//do some destroy things,... i get called twice too
}
}
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
1)
MyTestClassTest.setUp() line: 85
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner(MethodRoadie).runBefores() …Run Code Online (Sandbox Code Playgroud)