Stella981 Stella981
3年前
JUnit4源码分析运行原理
提个问题:Java程序的入口是main方法,而JUnit类中没有main方法,那么JUnit是如何运行的呢?假如有以下JUnit例子:importorg.junit.Test;publicclassTestA{@TestpublicvoidtestAdd(){
Wesley13 Wesley13
3年前
C# 代码片段
一、List<byte和byte\\转换方法1:Byte bytes;     // 复制源List<Byte lbyte  new List<Byte;  // 复制目的方法2:// 迭代 bytes 数组中的内容后添加到 lbyte 中foreach(
Easter79 Easter79
3年前
Tomcat启动失败 提示Server Tomcat v7.0 Server at localhost failed to start.六种解决方法
Tomcat启动失败提示ServerTomcatv7.0Serveratlocalhostfailedtostart.六种解决方法参考文章:(1)Tomcat启动失败提示ServerTomcatv7.0Serveratlocalhostfailedtostart.六种解决方法(https://www.o
Stella981 Stella981
3年前
JavaScript中判断数组是否包含某个元素
javascript的Array没有contains方法,有时候这会不方便,contains方法实现很简单可以扩展Array类,如下:写法1.Array.prototype.containsfunction(obj){varithis.length;while(i){
Stella981 Stella981
3年前
Shiro源码分析
    在Shiro中,登录操作是由Subject的login()方法完成的,Subject是个接口,在Web环境中,实现类为WebDelegatingSubject,login方法从DeletatingSubject继承而来:publicvoidlogin(AuthenticationTokentoken)throwsAuthenti
Wesley13 Wesley13
3年前
Java异常处理
throws表示当前方法不处理异常,而是交给方法的调用出去处理;throw表示直接抛出一个异常;publicclassDemo1{/把异常向外面抛@throwsNumberFormatException/publi
Easter79 Easter79
3年前
Thread源码分析
start方法publicsynchronizedvoidstart(){/Thismethodisnotinvokedforthemainmethodthreador"system"groupthreadscreated/setupby
Wesley13 Wesley13
3年前
MySQL常用函数,你真得看看!
概念:相当于java中的方法,将一组逻辑语句封装在方法体中,对外暴露方法名隐藏了实现细节提高代码的可重用性使用:select函数名(实参列表)【from表】  【】中内容可省略正文:字符函数:length:获取字节个数(utf8一个汉字为3个字节,gb
Wesley13 Wesley13
3年前
5分钟掌握JUnit要点
第一分钟:声明测试方法新建一个类,在要测试的方法上面添加@Test注解importorg.junit.Test;importstaticorg.junit.Assert.assertEquals;publicclassUserServiceTest{@Testpublic
Wesley13 Wesley13
3年前
Java ConcurrentModificationException异常原因和解决方法
JavaConcurrentModificationException异常原因和解决方法参考文章:(1)JavaConcurrentModificationException异常原因和解决方法(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fwww.codeprj.c