()
| 54 | System.out.println(after-current); |
| 55 | } |
| 56 | @Test |
| 57 | public void createNewFileName() { |
| 58 | String originalFilename = "niubi.png"; |
| 59 | // 获取后缀 |
| 60 | String suffix = StrUtil.subAfter(originalFilename, ".", true); |
| 61 | // 生成目录 |
| 62 | String name = UUID.randomUUID().toString(); |
| 63 | int hash = name.hashCode(); |
| 64 | int d1 = hash & 0xF; |
| 65 | int d2 = (hash >> 4) & 0xF; |
| 66 | // 判断目录是否存在 |
| 67 | File dir = new File(SystemConstants.IMAGE_UPLOAD_DIR, StrUtil.format("/blogs/{}/{}", d1, d2)); |
| 68 | if (!dir.exists()) { |
| 69 | dir.mkdirs(); |
| 70 | } |
| 71 | // 生成文件名 |
| 72 | String format = StrUtil.format("/test/{}/{}/{}.{}", d1, d2, name, suffix); |
| 73 | } |
| 74 | |
| 75 | @Test |
| 76 | public void loadShopData(){ |
nothing calls this directly
no outgoing calls
no test coverage detected