[MOB-17093] Part 2 - Unit tests with mockito and core 2.x#10
[MOB-17093] Part 2 - Unit tests with mockito and core 2.x#10emdobrin merged 16 commits intoadobe:dev-v2.0.0from
Conversation
…and data unwrapping
prudrabhat
left a comment
There was a problem hiding this comment.
Similar suggestion as https://github.com/adobe/aepsdk-edge-android/pull/9/files#r1048941752 which will be addressed later. Looks good to me otherwise.
| } | ||
|
|
||
| private void mockHubSharedState(final Map<String, Object> hub) { | ||
| private void verifyGetSharedStateCalls(final int configTimes, final int identityTimes, final int consentTimes) { |
There was a problem hiding this comment.
I think it may be better if these verify calls are invoked individually inline within the unit test because the utility method masks whether a normal shared state or xdm shared state is verified, the exact event and the resolution being queried for.
There was a problem hiding this comment.
I would defer this in order to keep the test body concise and easy to read, but I can document the utility API if that helps
| * @param event an event containing {@link ExperienceEvent} data for processing; the event data should not be null/empty | ||
| */ | ||
| void handleExperienceEventRequest(@NonNull final Event event) { | ||
| if (Utils.isNullOrEmpty(event.getEventData())) { |
There was a problem hiding this comment.
These checks were moved from listeners to handlers, I compared them with the iOS implementation also and they now match that. The only handler that does not check for event data payload is getLocationHint, seems like we don't do that check in iOS.
|
|
||
| //verify | ||
| assertEquals(1, edgeExtension.getCachedEvents().size()); | ||
| verifyEventQueued(event1); |
There was a problem hiding this comment.
the queued events are now verified with a mocked hit queue
| } | ||
|
|
||
| @Test | ||
| public void testBootupIfNeeded_whenConsentNotRegistered_updatesConsentYes() { |
There was a problem hiding this comment.
moved from EdgeExtensionTests
| } | ||
|
|
||
| @Test | ||
| public void testHandleExperienceEventRequest_whenEmptyEventData_ignoresEvent() { |
There was a problem hiding this comment.
moved from the ListenerTests class
Description
Related Issue
Changes are based on #9 which would need to be merged first.
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: