import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.izouma.awesomeadmin.service.UserInfoService; import org.json.JSONObject; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.GenericXmlContextLoader; import org.springframework.transaction.annotation.Transactional; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; @RunWith(value = SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:/spring/applicationContext.xml"}, loader = GenericXmlContextLoader.class) @Transactional public class UserServiceTest { @Autowired private UserInfoService userInfoService; @Test public void testFindDepartLeader() { System.out.println(userInfoService.findDepartLeader("84666")); } @Test public void testFindUserByRoleName() { System.out.println(userInfoService.findUserByRoleName("hr")); } @Test public void testImage() { try { File file = new File("D:\\项目资料\\图途象平台\\B04A5311.CR2"); BufferedImage image = ImageIO.read(file); ImageIO.write(image, "jpg", new File("D:\\项目资料\\图途象平台\\B04A5311.jpg")); } catch (Exception e) { e.printStackTrace(); } } }