package com.mes;
|
|
import com.mes.md.mapper.AccountMapper;
|
import com.mes.md.service.AccountService;
|
import com.mes.tools.HexConversion;
|
import lombok.extern.slf4j.Slf4j;
|
import org.junit.Test;
|
import org.junit.runner.RunWith;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.Random;
|
|
/**
|
* @Author : yanzhixin
|
* @Date: 2024/3/27 16:37
|
* @Description:
|
*/
|
@Slf4j
|
@RunWith(SpringRunner.class)
|
@SpringBootTest(classes = DeviceInteractionModuleApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
public class DeviceInteractionModuleApplicationTest {
|
|
@Autowired
|
AccountMapper AccountMapper;
|
|
@Autowired
|
AccountService accountService;
|
|
@Test
|
public void testFindPath() {
|
//String url = getClass().getResource("").getPath();
|
//log.info("完整路径:{}", Arrays.asList(url));
|
|
log.info("完整路径");
|
}
|
@Test
|
public void testByte() {
|
//String url = getClass().getResource("").getPath();
|
//log.info("完整路径:{}", Arrays.asList(url));
|
byte[] msgs = new byte[2048];
|
msgs[0]=(byte)0;
|
msgs[1]=Byte.parseByte("1") ;
|
int g=HexConversion.bytesToInt(msgs,0);
|
|
String message = HexConversion.byteToHexString(4, msgs);
|
byte font=msgs[1];
|
String[] fontBit=String.format("%8s", Integer.toBinaryString((int)font)).replace(" ", "0").split("");
|
byte[] bit=new byte[1];
|
bit[0]=Byte.parseByte(fontBit[7]) ;
|
log.info("结果:{},{}",fontBit,bit);
|
//log.info("结果:{},{},{},{},{}",msgs,message,g,(msgs[0] & 0xFF),((msgs[1] & 0xFF)<<8));
|
}
|
@Test
|
public void testFindAccount() {
|
Map<String, Object> Account=accountService.selectAccount("beibo","57858555");
|
if(Account.isEmpty()){
|
System.out.println("成功");
|
}
|
log.info("{}",Account);
|
}
|
|
|
|
}
|