-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Itbl code coverage #731
base: master
Are you sure you want to change the base?
Conversation
…LNotification.java' and 'IterableApi.java'
Itbl code coverage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like its stubs which are not actually testing anything as such
public void testOnCreateWithValidArgs() { | ||
IterableInAppManager mockInAppManager = mock(IterableInAppManager.class); | ||
when(mockIterableApi.getInAppManager()).thenReturn(mockInAppManager); | ||
|
||
when(mockBundle.getString("HTML", null)).thenReturn("html content"); | ||
when(mockBundle.getBoolean("CallbackOnCancel", false)).thenReturn(true); | ||
when(mockBundle.getString("MessageId")).thenReturn("message123"); | ||
when(mockBundle.getDouble("BackgroundAlpha")).thenReturn(0.7); | ||
|
||
htmlNotification.setArguments(mockBundle); | ||
htmlNotification.onCreate(null); | ||
|
||
assertEquals("message123", "message123"); | ||
assertTrue(true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not making sense. Its asserting string value to string value.
@Test | ||
public void testOnCreateWithNullArgs() { | ||
htmlNotification.onCreate(null); | ||
assertEquals("message123", "message123"); | ||
assertFalse(false); | ||
} | ||
|
||
@Test | ||
public void testSetLoaded() { | ||
assertFalse(false); | ||
htmlNotification.setLoaded(true); | ||
assertTrue(true); | ||
htmlNotification.setLoaded(false); | ||
assertFalse(false); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods are not testing anything
public void testOnDestroy() { | ||
if (htmlNotification.getActivity() != null && htmlNotification.getActivity().isChangingConfigurations()) { | ||
return; | ||
} | ||
htmlNotification.onDestroy(); | ||
htmlNotification = null; | ||
location = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after destruction, its not asserting anything?
public void testResize_ExceptionHandling() { | ||
AlertDialog dialogMock = Mockito.mock(AlertDialog.class); | ||
Window windowMock = Mockito.mock(Window.class); | ||
|
||
when(htmlNotification.getDialog()).thenReturn(dialogMock); | ||
when(dialogMock.getWindow()).thenReturn(windowMock); | ||
|
||
doThrow(new IllegalArgumentException("Test Exception")).when(windowMock).setLayout(anyInt(), anyInt()); | ||
htmlNotification.resize(0.5f); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever, we do a - do().when()
Its basically a setup.
That setup is used to then check if if the setup was followed due to invocation of some methods that we want to test. Here, we are missing that.
🔹 Jira Ticket(s) if any
✏️ Description