File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
core/src/test/java/com/ibm/watson/developer_cloud/util Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 2020import java .util .Hashtable ;
2121
2222import static org .junit .Assert .assertEquals ;
23+ import static org .junit .Assert .assertFalse ;
2324import static org .junit .Assert .assertNull ;
25+ import static org .junit .Assert .assertTrue ;
2426
2527/**
2628 * The Class CredentialUtilsTest.
@@ -73,4 +75,26 @@ public void testGetVcapValueWithoutPlan() {
7375 public void testGetVcapValueWithMultiplePlans () {
7476 assertEquals (NOT_A_FREE_USERNAME , CredentialUtils .getVcapValue (SERVICE_NAME , USERNAME ));
7577 }
78+
79+ @ Test
80+ public void testBadCredentialChar () {
81+ // valid
82+ assertFalse (CredentialUtils .hasBadStartOrEndChar ("this_is_fine" ));
83+
84+ // starting bracket
85+ assertTrue (CredentialUtils .hasBadStartOrEndChar ("{bad_username" ));
86+ assertTrue (CredentialUtils .hasBadStartOrEndChar ("{{still_bad" ));
87+
88+ // ending bracket
89+ assertTrue (CredentialUtils .hasBadStartOrEndChar ("invalid}" ));
90+ assertTrue (CredentialUtils .hasBadStartOrEndChar ("also_invalid}}" ));
91+
92+ // starting quote
93+ assertTrue (CredentialUtils .hasBadStartOrEndChar ("\" not_allowed_either" ));
94+ assertTrue (CredentialUtils .hasBadStartOrEndChar ("\" \" still_not" ));
95+
96+ // ending quote
97+ assertTrue (CredentialUtils .hasBadStartOrEndChar ("nope\" " ));
98+ assertTrue (CredentialUtils .hasBadStartOrEndChar ("sorry\" \" " ));
99+ }
76100}
You can’t perform that action at this time.
0 commit comments