forked from usdot-jpo-ode/jpo-ode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into open-ode
- Loading branch information
Showing
9 changed files
with
119 additions
and
21 deletions.
There are no files selected for viewing
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
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
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
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
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
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
54 changes: 54 additions & 0 deletions
54
jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DdsAdvisoryDetailsTest.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 us.dot.its.jpo.ode.plugin.j2735; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import org.junit.Test; | ||
|
||
import mockit.Tested; | ||
import us.dot.its.jpo.ode.plugin.ieee1609dot2.Ieee1609Dot2DataTag; | ||
import us.dot.its.jpo.ode.plugin.j2735.DdsAdvisoryDetails.AdvisoryBroadcastType; | ||
import us.dot.its.jpo.ode.util.CodecUtils; | ||
|
||
public class DdsAdvisoryDetailsTest { | ||
|
||
@Tested | ||
DdsAdvisoryDetails testDdsAdvisoryDetails; | ||
|
||
@Test | ||
public void testSettersGetters() { | ||
testDdsAdvisoryDetails.setAsdmID("testAsdmID"); | ||
testDdsAdvisoryDetails.setAsdmType(1); | ||
testDdsAdvisoryDetails.setDistType(CodecUtils.toHex(DdsAdvisorySituationData.IP)); | ||
testDdsAdvisoryDetails.setStartTime(new J2735DFullTime()); | ||
testDdsAdvisoryDetails.setStopTime(new J2735DFullTime()); | ||
testDdsAdvisoryDetails.setAdvisoryMessageBytes("testAdvisoryMessageBytes"); | ||
testDdsAdvisoryDetails.setAdvisoryMessage(new Ieee1609Dot2DataTag()); | ||
|
||
assertEquals("testAsdmID", testDdsAdvisoryDetails.getAsdmID()); | ||
assertEquals(1, testDdsAdvisoryDetails.getAsdmType()); | ||
assertEquals("02", testDdsAdvisoryDetails.getDistType()); | ||
assertNotNull(testDdsAdvisoryDetails.getStartTime()); | ||
assertNotNull(testDdsAdvisoryDetails.getStopTime()); | ||
assertEquals("testAdvisoryMessageBytes", testDdsAdvisoryDetails.getAdvisoryMessageBytes()); | ||
assertNotNull(testDdsAdvisoryDetails.getAdvisoryMessage()); | ||
} | ||
|
||
@Test | ||
public void testHashCodeAndEquals() { | ||
String distType = CodecUtils.toHex(DdsAdvisorySituationData.RSU); | ||
|
||
DdsAdvisoryDetails ddsad1 = new DdsAdvisoryDetails("asdmID", AdvisoryBroadcastType.tim, distType, new J2735DFullTime(), | ||
new J2735DFullTime(), new Ieee1609Dot2DataTag()); | ||
DdsAdvisoryDetails ddsad2 = new DdsAdvisoryDetails("asdmID", AdvisoryBroadcastType.tim, distType, new J2735DFullTime(), | ||
new J2735DFullTime(), new Ieee1609Dot2DataTag()); | ||
DdsAdvisoryDetails ddsad3 = new DdsAdvisoryDetails("asdmID", AdvisoryBroadcastType.map, distType, new J2735DFullTime(), | ||
new J2735DFullTime(), new Ieee1609Dot2DataTag()); | ||
|
||
assertEquals("Expected identical hashcodes", ddsad1.hashCode(), ddsad2.hashCode()); | ||
assertNotEquals("Expected different hashcodes", ddsad2.hashCode(), ddsad3.hashCode()); | ||
|
||
assertTrue("Expected objects to be equal", ddsad1.equals(ddsad2)); | ||
assertFalse("Expected objects to not be equal", ddsad2.equals(ddsad3)); | ||
} | ||
|
||
} |
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
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