jkevan commented on a change in pull request #254:
URL: https://github.com/apache/unomi/pull/254#discussion_r581229860
##########
File path: itests/src/test/java/org/apache/unomi/itests/SegmentIT.java
##########
@@ -54,4 +58,43 @@ public void testSegments() {
Assert.assertEquals("Segment metadata list should be empty", 0,
segmentMetadatas.size());
LOGGER.info("Retrieved " + segmentMetadatas.size() + " segment
metadata entries");
}
+
+ @Test(expected = BadSegmentConditionException.class)
+ public void testSegmentWithNullCondition() {
+ Metadata segmentMetadata = new Metadata(SEGMENT_ID);
+ Segment segment = new Segment();
+ segment.setMetadata(segmentMetadata);
+ segment.setCondition(null);
+
+ segmentService.setSegmentDefinition(segment);
+ }
+
+ @Test(expected = BadSegmentConditionException.class)
+ public void testSegmentWithInValidCondition() {
+ Metadata segmentMetadata = new Metadata(SEGMENT_ID);
+ Segment segment = new Segment();
+ segment.setMetadata(segmentMetadata);
+ Condition condition = new Condition();
+ condition.setParameter("param", "param value");
+ condition.setConditionTypeId("fakeConditionId");
+ segment.setCondition(condition);
+
+ segmentService.setSegmentDefinition(segment);
+ }
+
+ @Test
+ public void testSegmentWithValidCondition() {
+ Metadata segmentMetadata = new Metadata(SEGMENT_ID);
+ Segment segment = new Segment(segmentMetadata);
+ Condition segmentCondition = new
Condition(definitionsService.getConditionType("pastEventCondition"));
+ segmentCondition.setParameter("minimumEventCount", 2);
Review comment:
thx for the feedback I added a test for that in current PR
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]