File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
cloudinary-test-common/src/main/java/com/cloudinary/test Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -608,7 +608,8 @@ public void testManualModeration() throws Exception {
608608 }
609609
610610 @ Test
611- public void testOcrUpdate () {
611+ public void testOcrUpdate () throws Exception {
612+ assumeAddonEnabled ("ocr" );
612613 Exception expected = null ;
613614 // should support requesting ocr info
614615 try {
Original file line number Diff line number Diff line change 44import com .cloudinary .utils .ObjectUtils ;
55import com .cloudinary .utils .StringUtils ;
66
7+ import static org .junit .Assume .assumeTrue ;
8+
79import java .io .IOException ;
10+ import java .util .Arrays ;
11+ import java .util .List ;
812import java .util .Map ;
913import java .util .Random ;
1014
@@ -36,4 +40,22 @@ protected Map preloadResource(Map options) throws IOException {
3640 combinedOptions .putAll (options );
3741 return cloudinary .uploader ().upload ("http://res.cloudinary.com/demo/image/upload/sample" , combinedOptions );
3842 }
43+
44+ private static final List <String > enabledAddons = getEnabledAddons ();
45+
46+ protected void assumeAddonEnabled (String addon ) throws Exception {
47+ boolean enabled = enabledAddons .contains (addon .toLowerCase ())
48+ || (enabledAddons .size () == 1 && enabledAddons .get (0 ).equalsIgnoreCase ("all" ));
49+
50+ assumeTrue (String .format ("Use CLD_TEST_ADDONS environment variable to enable tests for %s." , addon ), enabled );
51+ }
52+
53+ private static List <String > getEnabledAddons () {
54+ String envAddons = System .getenv ()
55+ .getOrDefault ("CLD_TEST_ADDONS" , "" )
56+ .toLowerCase ()
57+ .replaceAll ("\\ s" , "" );
58+
59+ return Arrays .asList (envAddons .split ("," ));
60+ }
3961}
You can’t perform that action at this time.
0 commit comments