Skip to content

Commit c2b2360

Browse files
authored
Merge pull request #760 from nsacyber/v3_issue_759-unittest
Fixed issue in DeviceInfoReportTest
2 parents 49e53e9 + cf6019d commit c2b2360

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

HIRS_AttestationCA/src/test/java/hirs/attestationca/persist/entity/userdefined/report/DeviceInfoReportTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import hirs.attestationca.persist.entity.userdefined.info.HardwareInfo;
88
import hirs.attestationca.persist.entity.userdefined.info.FirmwareInfo;
99

10+
import hirs.utils.VersionHelper;
1011
import org.junit.jupiter.api.Test;
1112
import static org.junit.jupiter.api.Assertions.assertEquals;
1213
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -21,7 +22,7 @@ public class DeviceInfoReportTest extends AbstractUserdefinedEntityTest {
2122
private final HardwareInfo hardwareInfo = createTestHardwareInfo();
2223
private final TPMInfo tpmInfo = createTPMInfo();
2324

24-
private static final String EXPECTED_CLIENT_VERSION = "Test.Version";
25+
private static final String EXPECTED_CLIENT_VERSION = VersionHelper.getVersion();
2526

2627
/**
2728
* Tests instantiation of a DeviceInfoReport.

HIRS_AttestationCA/src/test/resources/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

HIRS_Utils/src/test/java/hirs/utils/VersionHelperTest.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,19 @@
22

33
import org.junit.jupiter.api.Test;
44

5-
import static org.junit.jupiter.api.Assertions.assertTrue;
6-
import static org.junit.jupiter.api.Assertions.assertEquals;
5+
import static org.junit.jupiter.api.Assertions.assertNotNull;
76

87
/**
98
* Tests for VersionHelper.
109
*/
1110
public class VersionHelperTest {
1211

1312
/**
14-
* Test that case where a version file does not exist.
15-
*/
16-
@Test
17-
public void testGetVersionFail() {
18-
String actual = VersionHelper.getVersion("somefile");
19-
assertTrue(actual.startsWith(""));
20-
}
21-
22-
/**
23-
* Test that a version file exists and can be read properly.
13+
* Test that a version file exists in /opt/hirs or /etc/hirs and is not empty.
2414
*/
2515
@Test
2616
public void testGetVersionDefault() {
27-
String expected = "Test.Version";
28-
String actual = VersionHelper.getVersion("VERSION");
29-
assertEquals(expected, actual);
17+
String actual = VersionHelper.getVersion();
18+
assertNotNull(actual);
3019
}
3120
}

HIRS_Utils/src/test/resources/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)