package org.xmx0632.deliciousfruit.api.v1.helper;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class PasswordHelperTest {
@Test
public void testMd5() {
assertEquals("b0baee9d279d34fa1dfd71aadb908c3f",
PasswordHelper.md5("11111"));
}
@Test
public void testGeneratePassword() {
// long c = System.currentTimeMillis();// 1367 8419 3205 4
long c = 1367841932054L;
System.out.println(c);
String cc = String.valueOf(c);
String password = PasswordHelper.generatePassword(cc, 6);
assertEquals("932054", password);
}
@Test
public void testGeneratePassword1() {
long c = 932054L;
System.out.println(c);
String cc = String.valueOf(c);
String password = PasswordHelper.generatePassword(cc, 6);
assertEquals("932054", password);
}
@Test
public void testGeneratePassword2() {
long c = 1932054L;
System.out.println(c);
String cc = String.valueOf(c);
String password = PasswordHelper.generatePassword(cc, 6);
assertEquals("932054", password);
}
@Test
public void testGeneratePassword3() {
long c = 11932054L;
System.out.println(c);
String cc = String.valueOf(c);
String password = PasswordHelper.generatePassword(cc, 6);
assertEquals("932054", password);
}
@Test
public void testGeneratePasswordByLength() {
long c = 5511112222333L;
System.out.println(c);
String cc = String.valueOf(c);
String password = PasswordHelper.generatePassword(cc, 6);
assertEquals("222333", password);
}
@Test
public void testGeneratePasswordByLength1() {
long c = 5511112222333L;
System.out.println(c);
String cc = String.valueOf(c);
String password = PasswordHelper.generatePassword(cc, 4);
assertEquals("2333", password);
}
@Test
public void testGeneratePasswordByLength2() {
long c = 5511112222333L;
System.out.println(c);
String cc = String.valueOf(c);
String password = PasswordHelper.generatePassword(cc, 3);
assertEquals("333", password);
}
}