Junit Test使用样例
生活随笔
收集整理的這篇文章主要介紹了
Junit Test使用样例
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前些天發現了一個巨牛的人工智能學習網站,通俗易懂,風趣幽默,忍不住分享一下給大家。點擊跳轉到教程。
配置:
?
?
?
?
?
調用類:
?
import java.util.List;import javax.annotation.Resource;import org.apache.shiro.crypto.RandomNumberGenerator; import org.apache.shiro.crypto.SecureRandomNumberGenerator; import org.apache.shiro.crypto.hash.SimpleHash; import org.apache.shiro.util.ByteSource; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;import com.entity.AuthAdmin; import com.mapper.AuthAdminMapper;@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:applicationContext.xml") public class Test {@Resourceprivate AuthAdminMapper _authAdminMapper;@org.junit.Testpublic void test() {AuthAdmin admin = new AuthAdmin();admin.setAccount("admin");List<AuthAdmin> list = _authAdminMapper.selectAuthAdmin(admin);System.out.println(list.size());}public static void main(String[] args) {RandomNumberGenerator randomNumberGenerator = new SecureRandomNumberGenerator();String salt = randomNumberGenerator.nextBytes().toHex();String newPassword = new SimpleHash("md5","admin",ByteSource.Util.bytes(salt),2).toHex();System.out.println(salt);System.out.println(newPassword);} }?
?
?
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的Junit Test使用样例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于装箱与拆箱
- 下一篇: 代码生成器的存在价值 选择自 m