1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-26 12:58:02 +01:00

Improve OpenPgpV4FingerprintTests

This commit is contained in:
Paul Schaub 2018-07-24 14:28:41 +02:00
parent 9b68ee67d9
commit e7a6df5a87
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 12 additions and 2 deletions

View file

@ -50,7 +50,7 @@ allprojects {
mavenCentral()
}
ext {
project.ext {
junitVersion = 4.12
androidBootClasspath = getAndroidRuntimeJar(pgpainlessMinAndroidSdk)
rootConfigDir = new File(rootDir, 'config')
@ -67,7 +67,7 @@ allprojects {
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.')
}
if (!version.endsWith('-SNAPSHOT') && version != 'git tag --points-at HEAD'.execute().text.trim()) {

View file

@ -16,6 +16,7 @@
package org.pgpainless;
import static junit.framework.TestCase.assertEquals;
import static org.junit.Assert.assertNotEquals;
import java.io.IOException;
@ -42,6 +43,11 @@ public class OpenPgpV4FingerprintTest {
String fp = "4A4F48414E4E53454E2049532041204E45524421";
OpenPgpV4Fingerprint finger = new OpenPgpV4Fingerprint(fp);
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
@ -55,6 +61,10 @@ public class OpenPgpV4FingerprintTest {
public void equalsOtherFingerprintTest() {
OpenPgpV4Fingerprint 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