-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5f655a
commit e8814af
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
...tationca/persist/entity/userdefined/certificate/attributes/TPMSecurityAssertionsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package hirs.attestationca.persist.entity.userdefined.certificate.attributes; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
import static org.junit.jupiter.api.Assertions.fail; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Tests for the TPMSecurityAssertions class. | ||
*/ | ||
public class TPMSecurityAssertionsTest { | ||
|
||
/** | ||
* Tests that enum integer association matches the TCG spec for the EK Generation | ||
* Type enum. | ||
*/ | ||
@Test | ||
public void testEkGenTypeEnum() { | ||
assertEquals(TPMSecurityAssertions.EkGenerationType.values()[0], | ||
TPMSecurityAssertions.EkGenerationType.INTERNAL); | ||
assertEquals(TPMSecurityAssertions.EkGenerationType.values()[1], | ||
TPMSecurityAssertions.EkGenerationType.INJECTED); | ||
assertEquals(TPMSecurityAssertions.EkGenerationType.values()[2], | ||
TPMSecurityAssertions.EkGenerationType.INTERNAL_REVOCABLE); | ||
assertEquals(TPMSecurityAssertions.EkGenerationType.values()[3], | ||
TPMSecurityAssertions.EkGenerationType.INJECTED_REVOCABLE); | ||
try { | ||
assertNull(TPMSecurityAssertions.EkGenerationType.values()[4]); | ||
fail(); | ||
} catch (ArrayIndexOutOfBoundsException e) { | ||
return; | ||
} | ||
} | ||
|
||
/** | ||
* Tests that enum integer association matches the TCG spec for the Generation | ||
* Location enum. | ||
*/ | ||
@Test | ||
public void testGenLocationEnum() { | ||
assertEquals(TPMSecurityAssertions.EkGenerationLocation.values()[0], | ||
TPMSecurityAssertions.EkGenerationLocation.TPM_MANUFACTURER); | ||
assertEquals(TPMSecurityAssertions.EkGenerationLocation.values()[1], | ||
TPMSecurityAssertions.EkGenerationLocation.PLATFORM_MANUFACTURER); | ||
assertEquals(TPMSecurityAssertions.EkGenerationLocation.values()[2], | ||
TPMSecurityAssertions.EkGenerationLocation.EK_CERT_SIGNER); | ||
try { | ||
assertNull(TPMSecurityAssertions.EkGenerationLocation.values()[3]); | ||
fail(); | ||
} catch (ArrayIndexOutOfBoundsException e) { | ||
return; | ||
} | ||
} | ||
} |