parent
d55089e6bc
commit
fe7dd01731
@ -1,84 +0,0 @@
|
||||
package com.example.hamburger;
|
||||
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import com.example.hamburger.dao.UserDao;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.EditText;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
import android.widget.Button;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.annotation.SuppressLint;
|
||||
import com.example.hamburger.dao.UserDao;
|
||||
import com.example.hamburger.entity.User;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class Mtest {
|
||||
|
||||
@Test
|
||||
public void text_1() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.example.hamburger", appContext.getPackageName());
|
||||
|
||||
new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
UserDao userDao = new UserDao();
|
||||
int msg = userDao.login("1","1");
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void text_2() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.example.hamburger", appContext.getPackageName());
|
||||
|
||||
User user = new User();
|
||||
|
||||
user.setUserAccount("11");
|
||||
user.setUserPassword("11");
|
||||
user.setUserName("11");
|
||||
user.setUserType(1);
|
||||
user.setUserState(0);
|
||||
user.setUserDel(0);
|
||||
|
||||
new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
int msg = 0;
|
||||
|
||||
UserDao userDao = new UserDao();
|
||||
|
||||
User uu = userDao.findUser(user.getUserAccount());
|
||||
if(uu != null){
|
||||
msg = 1;
|
||||
}
|
||||
else{
|
||||
boolean flag = userDao.register(user);
|
||||
if(flag){
|
||||
msg = 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}.start();
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in new issue