REO progress
This commit is contained in:
parent
bceb432bdc
commit
aeb3cf3db3
|
@ -0,0 +1,10 @@
|
|||
package com.rusefi.ui;
|
||||
|
||||
public class AutoTokenUtil {
|
||||
public static boolean isToken(String content) {
|
||||
content = content.trim();
|
||||
if (content.length() != 8 + 1 + 4 + 1 + 4 + 1 + 4 + 1 + 12)
|
||||
return false;
|
||||
return content.charAt(8) == '-' && content.charAt(8 + 1 + 4) == '-';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.rusefi.ui.test;
|
||||
|
||||
import com.rusefi.ui.AutoTokenUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class AuthTokenUtilTest {
|
||||
@Test
|
||||
public void test() {
|
||||
assertTrue(AutoTokenUtil.isToken(" 11112222-5719-4444-84d4-111122223333 "));
|
||||
|
||||
assertFalse(AutoTokenUtil.isToken(" 11112222x5719-4444-84d4-111122223333 "));
|
||||
|
||||
assertFalse(AutoTokenUtil.isToken(" 11112222-5719-4444-84d4-11112222333 "));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue