mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-25 22:02:05 +01:00
Improve OpenPgpV4FingerprintTests
This commit is contained in:
parent
9b68ee67d9
commit
e7a6df5a87
2 changed files with 12 additions and 2 deletions
|
@ -50,7 +50,7 @@ allprojects {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
project.ext {
|
||||||
junitVersion = 4.12
|
junitVersion = 4.12
|
||||||
androidBootClasspath = getAndroidRuntimeJar(pgpainlessMinAndroidSdk)
|
androidBootClasspath = getAndroidRuntimeJar(pgpainlessMinAndroidSdk)
|
||||||
rootConfigDir = new File(rootDir, 'config')
|
rootConfigDir = new File(rootDir, 'config')
|
||||||
|
@ -67,7 +67,7 @@ allprojects {
|
||||||
version = version + '-SNAPSHOT'
|
version = version + '-SNAPSHOT'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ext.isSnapshot && !'git describe --exact-match HEAD'.execute().text.trim().equals(ext.shortVersion)) {
|
if (!project.ext.isSnapshot && !'git describe --exact-match HEAD'.execute().text.trim().equals(ext.shortVersion)) {
|
||||||
throw new InvalidUserDataException('Untagged version detected! Please tag every release.')
|
throw new InvalidUserDataException('Untagged version detected! Please tag every release.')
|
||||||
}
|
}
|
||||||
if (!version.endsWith('-SNAPSHOT') && version != 'git tag --points-at HEAD'.execute().text.trim()) {
|
if (!version.endsWith('-SNAPSHOT') && version != 'git tag --points-at HEAD'.execute().text.trim()) {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
package org.pgpainless;
|
package org.pgpainless;
|
||||||
|
|
||||||
import static junit.framework.TestCase.assertEquals;
|
import static junit.framework.TestCase.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -42,6 +43,11 @@ public class OpenPgpV4FingerprintTest {
|
||||||
String fp = "4A4F48414E4E53454E2049532041204E45524421";
|
String fp = "4A4F48414E4E53454E2049532041204E45524421";
|
||||||
OpenPgpV4Fingerprint finger = new OpenPgpV4Fingerprint(fp);
|
OpenPgpV4Fingerprint finger = new OpenPgpV4Fingerprint(fp);
|
||||||
assertEquals(fp, finger.toString());
|
assertEquals(fp, finger.toString());
|
||||||
|
assertEquals(fp.length(), finger.length());
|
||||||
|
for (int i = 0; i < finger.length(); i++) {
|
||||||
|
assertEquals(fp.charAt(i), finger.charAt(i));
|
||||||
|
}
|
||||||
|
assertEquals("4A4F", finger.subSequence(0, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -55,6 +61,10 @@ public class OpenPgpV4FingerprintTest {
|
||||||
public void equalsOtherFingerprintTest() {
|
public void equalsOtherFingerprintTest() {
|
||||||
OpenPgpV4Fingerprint finger = new OpenPgpV4Fingerprint("5448452043414b452049532041204c4945212121");
|
OpenPgpV4Fingerprint finger = new OpenPgpV4Fingerprint("5448452043414b452049532041204c4945212121");
|
||||||
assertEquals(finger, new OpenPgpV4Fingerprint("5448452043414B452049532041204C4945212121"));
|
assertEquals(finger, new OpenPgpV4Fingerprint("5448452043414B452049532041204C4945212121"));
|
||||||
|
assertEquals(0, finger.compareTo(new OpenPgpV4Fingerprint("5448452043414B452049532041204C4945212121")));
|
||||||
|
assertNotEquals(finger, new OpenPgpV4Fingerprint("0000000000000000000000000000000000000000"));
|
||||||
|
assertNotEquals(finger, null);
|
||||||
|
assertNotEquals(finger, new Object());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue