@Test public void testIsValidCommand() { Assert.assertTrue(ImageUtil.isValidCommand("32")); Assert.assertTrue(ImageUtil.isValidCommand("x50")); Assert.assertTrue(ImageUtil.isValidCommand("32x50")); Assert.assertTrue(ImageUtil.isValidCommand("32-c")); Assert.assertTrue(ImageUtil.isValidCommand("32x50-c")); Assert.assertTrue(ImageUtil.isValidCommand("32x50-c@100x100")); Assert.assertFalse(ImageUtil.isValidCommand("x")); Assert.assertFalse(ImageUtil.isValidCommand("x50-c")); Assert.assertFalse(ImageUtil.isValidCommand("32x50a")); Assert.assertFalse(ImageUtil.isValidCommand("32bx20")); Assert.assertFalse(ImageUtil.isValidCommand("100x100x100")); Assert.assertFalse(ImageUtil.isValidCommand("32x50@100x100")); Assert.assertFalse(ImageUtil.isValidCommand("32x")); }
public static final boolean isValidCommand(String command) { if (command.matches("(\\d+)|(\\d*x\\d+)") ) { return true; } if (command.matches("((\\d+)|(\\d+x\\d+))-c(\\@\\d+x\\d+)?")) { return true; } return false; }
ImageUtil { public static final boolean isValidCommand(String command) { if (command.matches("(\\d+)|(\\d*x\\d+)") ) { return true; } if (command.matches("((\\d+)|(\\d+x\\d+))-c(\\@\\d+x\\d+)?")) { return true; } return false; } }
ImageUtil { public static final boolean isValidCommand(String command) { if (command.matches("(\\d+)|(\\d*x\\d+)") ) { return true; } if (command.matches("((\\d+)|(\\d+x\\d+))-c(\\@\\d+x\\d+)?")) { return true; } return false; } private  ImageUtil(); }
ImageUtil { public static final boolean isValidCommand(String command) { if (command.matches("(\\d+)|(\\d*x\\d+)") ) { return true; } if (command.matches("((\\d+)|(\\d+x\\d+))-c(\\@\\d+x\\d+)?")) { return true; } return false; } private  ImageUtil(); static byte[] loadImage(String fullPath, String command); static byte[] loadImage(String fullPath, String command, boolean overrideOld); static byte[] loadImage(URL url, String command); static void cropImage(String fullPath, String command, int resizedWidth, boolean replaceOriginal); static byte[] getDefaultImage(); static boolean isLargerThan(InputStream inputStream, int width, int height); static final Image transformImage(Image img, String command); static final boolean isValidCommand(String command); static String createCropCommand(Integer newWidth, Integer newHeight,
			Integer fromX, Integer fromY); static String convertImageFiletoBase64(File imageFile); }
ImageUtil { public static final boolean isValidCommand(String command) { if (command.matches("(\\d+)|(\\d*x\\d+)") ) { return true; } if (command.matches("((\\d+)|(\\d+x\\d+))-c(\\@\\d+x\\d+)?")) { return true; } return false; } private  ImageUtil(); static byte[] loadImage(String fullPath, String command); static byte[] loadImage(String fullPath, String command, boolean overrideOld); static byte[] loadImage(URL url, String command); static void cropImage(String fullPath, String command, int resizedWidth, boolean replaceOriginal); static byte[] getDefaultImage(); static boolean isLargerThan(InputStream inputStream, int width, int height); static final Image transformImage(Image img, String command); static final boolean isValidCommand(String command); static String createCropCommand(Integer newWidth, Integer newHeight,
			Integer fromX, Integer fromY); static String convertImageFiletoBase64(File imageFile);  }