package com.mes; import com.mes.md.service.impl.RotatingRackServiceImpl; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * @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 { private RotatingRackServiceImpl rotatingRackService; @Test public void test() { // 测试代码 byte[] plcValueArray=new byte[]{1};//0000 0001 String binaryString1 = String.format("%8s",Integer.toBinaryString(plcValueArray[0] & 0xFF)) .replace(' ', '0'); //String bitAddress =Integer.toBinaryString(p & 0xFF); log.info("测试代码:{}",binaryString1); String values=binaryString1.substring(7-0,8-0); log.info("测试代码:{}",values); } @Test public void test1() { rotatingRackService.retryFailedErpSending(); } }