-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add equality functions for SelfDescribing and SelfDescribingJson so t…
- Loading branch information
1 parent
26655a9
commit edc2d23
Showing
4 changed files
with
133 additions
and
0 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
37 changes: 37 additions & 0 deletions
37
src/test/java/com/snowplowanalytics/snowplow/tracker/events/SelfDescribingTest.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,37 @@ | ||
package com.snowplowanalytics.snowplow.tracker.events; | ||
|
||
import com.snowplowanalytics.snowplow.tracker.payload.SelfDescribingJson; | ||
|
||
// JUnit | ||
import org.junit.Test; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotEquals; | ||
|
||
public class SelfDescribingTest { | ||
|
||
@Test | ||
public void testEqualityOfTwoInstances() { | ||
SelfDescribing.Builder<?> builder = SelfDescribing.builder() | ||
.eventData(new SelfDescribingJson("schema-name")); | ||
|
||
SelfDescribing a = new SelfDescribing( builder ); | ||
SelfDescribing b = new SelfDescribing( builder ); | ||
|
||
assertEquals(a, b); | ||
} | ||
|
||
@Test | ||
public void testNegativeEqualityOfTwoInstances() { | ||
SelfDescribing.Builder<?> builderOne = SelfDescribing.builder() | ||
.eventData(new SelfDescribingJson("schema-name-one")); | ||
|
||
SelfDescribing.Builder<?> builderTwo = SelfDescribing.builder() | ||
.eventData(new SelfDescribingJson("schema-name-two")); | ||
|
||
SelfDescribing a = new SelfDescribing( builderOne ); | ||
SelfDescribing b = new SelfDescribing( builderTwo ); | ||
|
||
assertNotEquals(a, b); | ||
} | ||
|
||
} |
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