fixed issue caused by change to version method

This commit is contained in:
iadgovuser58 2024-04-26 12:54:56 -04:00 committed by chubtub
parent 80ba36cbf2
commit 939240d284
4 changed files with 6 additions and 18 deletions

View File

@ -7,6 +7,7 @@ import hirs.attestationca.persist.entity.userdefined.info.NetworkInfo;
import hirs.attestationca.persist.entity.userdefined.info.HardwareInfo;
import hirs.attestationca.persist.entity.userdefined.info.FirmwareInfo;
import hirs.utils.VersionHelper;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -21,7 +22,7 @@ public class DeviceInfoReportTest extends AbstractUserdefinedEntityTest {
private final HardwareInfo hardwareInfo = createTestHardwareInfo();
private final TPMInfo tpmInfo = createTPMInfo();
private static final String EXPECTED_CLIENT_VERSION = "Test.Version";
private static final String EXPECTED_CLIENT_VERSION = VersionHelper.getVersion();
/**
* Tests instantiation of a DeviceInfoReport.

View File

@ -1 +0,0 @@
Test.Version

View File

@ -2,8 +2,7 @@ package hirs.utils;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* Tests for VersionHelper.
@ -11,21 +10,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
public class VersionHelperTest {
/**
* Test that case where a version file does not exist.
*/
@Test
public void testGetVersionFail() {
String actual = VersionHelper.getVersion("somefile");
assertTrue(actual.startsWith(""));
}
/**
* Test that a version file exists and can be read properly.
* Test that a version file exists in /opt/hirs or /etc/hirs and is not empty.
*/
@Test
public void testGetVersionDefault() {
String expected = "Test.Version";
String actual = VersionHelper.getVersion("VERSION");
assertEquals(expected, actual);
String actual = VersionHelper.getVersion();
assertNotNull(actual);
}
}

View File

@ -1 +0,0 @@
Test.Version