public static void upload(File[] files) throws FileNotFoundException { Files f = null; for (File file : files) { f = new Files(); f.name = file.getName(); f.path = ""; f.image = new Blob(); f.image.set(new FileInputStream(file), MimeTypes.getContentType(file.getName())); f.save(); renderText(f.id); } }
@Test public void testName() { final Condition<File> c = Files.name(".+[2468]\\.tmp$"); int i = 0; for (File file : testDir.listFiles()) { if (c.eval(file)) { i++; } } Assert.assertEquals(4, i); }