diff options
author | Fabrice Bellingard <fabrice.bellingard@sonarsource.com> | 2013-02-19 12:39:53 +0100 |
---|---|---|
committer | Fabrice Bellingard <fabrice.bellingard@sonarsource.com> | 2013-02-19 15:28:11 +0100 |
commit | 6c1a49788c7e35eac15a32f1c613b1a5a26fd5c8 (patch) | |
tree | 373f11af6798f9d29042f9c12ab83dcb191fe639 /sonar-plugin-api/src/test/java/org/sonar/api/config | |
parent | 9cfa406506d3be218922595bd2c1b02621e0bceb (diff) | |
download | sonarqube-6c1a49788c7e35eac15a32f1c613b1a5a26fd5c8.tar.gz sonarqube-6c1a49788c7e35eac15a32f1c613b1a5a26fd5c8.zip |
Add unit test
Diffstat (limited to 'sonar-plugin-api/src/test/java/org/sonar/api/config')
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/config/LicenseTest.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/LicenseTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/LicenseTest.java index 37e880e21fd..1bc5bb7f7d9 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/config/LicenseTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/LicenseTest.java @@ -102,6 +102,21 @@ public class LicenseTest { } @Test + public void trimBeforeReadingBase64() { + String encodedKeyWithTrailingWhiteSpaces = "Rm9vOiBiYXIKT3JnYW5pc2F0aW9uOiBBQkMgClNlcnZlcjogMTIzND \n" + + "UgICAKUHJvZHVjdDogU1FBTEUKICBFeHBpcmF0aW9uOiAyMDEyLTA1 \n" + + "LTE4ICAKVHlwZTogIEVWQUxVQVRJT04gICAKT3RoZXI6IGZpZWxkCg==\n"; + + License license = License.readBase64(new String(encodedKeyWithTrailingWhiteSpaces.getBytes())); + + assertThat(license.getOrganization(), Is.is("ABC")); + assertThat(license.getServer(), Is.is("12345")); + assertThat(license.getProduct(), Is.is("SQALE")); + assertThat(license.getExpirationDateAsString(), Is.is("2012-05-18")); + assertThat(license.getType(), Is.is("EVALUATION")); + } + + @Test public void readBase64_not_base64() { License license = License.readBase64("çé '123$@"); |