Skip to content

Commit 9e1d755

Browse files
author
Inbal Tako
committed
Add sdkevent test
1 parent 128256d commit 9e1d755

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,47 @@
11
package com.securenative.models;
22

3+
import com.securenative.config.SecureNativeConfigurationBuilder;
4+
import com.securenative.config.SecureNativeOptions;
5+
import com.securenative.enums.EventTypes;
6+
import com.securenative.exceptions.SecureNativeInvalidOptionsException;
7+
import org.junit.jupiter.api.DisplayName;
8+
import org.junit.jupiter.api.Test;
9+
10+
11+
import static org.junit.jupiter.api.Assertions.assertThrows;
12+
313
public class SDKEventTest {
14+
@Test
15+
@DisplayName("Should throw when creating sdk event invalid user-id")
16+
public void createSDKEventInvalidUserIdThrowTest() {
17+
SecureNativeOptions options = SecureNativeConfigurationBuilder.defaultConfigBuilder().build();
18+
EventOptions event = new EventOptions(EventTypes.LOG_IN.getType());
19+
event.setUserId("");
20+
21+
assertThrows(SecureNativeInvalidOptionsException.class, () -> {
22+
SDKEvent sdkEvent = new SDKEvent(event, options);
23+
});
24+
}
25+
26+
@Test
27+
@DisplayName("Should throw when creating sdk event without user-id")
28+
public void createSDKEventWithoutUserIdThrowTest() {
29+
SecureNativeOptions options = SecureNativeConfigurationBuilder.defaultConfigBuilder().build();
30+
EventOptions event = new EventOptions(EventTypes.LOG_IN.getType());
31+
32+
assertThrows(SecureNativeInvalidOptionsException.class, () -> {
33+
SDKEvent sdkEvent = new SDKEvent(event, options);
34+
});
35+
}
36+
37+
@Test
38+
@DisplayName("Should throw when creating sdk event without event type")
39+
public void createSDKEventWithoutEventTypeThrowTest() {
40+
SecureNativeOptions options = SecureNativeConfigurationBuilder.defaultConfigBuilder().build();
41+
EventOptions event = new EventOptions("");
42+
43+
assertThrows(SecureNativeInvalidOptionsException.class, () -> {
44+
SDKEvent sdkEvent = new SDKEvent(event, options);
45+
});
46+
}
447
}

0 commit comments

Comments
 (0)