import com.msb.enums.DirEnum; import org.junit.Assert; import org.junit.Test; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.Random; /** * @Author bingor * @Date 2022-10-01 10:48 * @Description: com.msb.test * @Version: 1.0 */ public class CommonTest { @Test public void testReadImage() throws IOException { BufferedImage bufferedImage = ImageIO.read(new File("E:\\myfile\\msb_马士兵教育体系\\课程下载的资源\\MCA高级构架师\\73-坦克大战(一期)\\images\\tankD.gif")); Assert.assertNotNull(bufferedImage); BufferedImage image = ImageIO.read(CommonTest.class.getClassLoader().getResourceAsStream("images/tankD.gif")); Assert.assertNotNull(image); } @Test public void testEnum() { Random random = new Random(); System.out.println(DirEnum.valueOf(random.nextInt(3))); System.out.println(DirEnum.valueOf(random.nextInt(3))); System.out.println(DirEnum.valueOf(random.nextInt(3))); System.out.println(DirEnum.valueOf(random.nextInt(3))); } @Test public void testCommon() { boolean bool = xh(); System.out.println(bool); } public boolean xh() { int [] indexs = {1, 2, 3, 4, 5, 6, 7, 8, 9 }; for (int index : indexs) { if(index == 5) return false; System.out.println(index); } return true; } }