Skip to content
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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

[Feature] Itbl code coverage #731

wants to merge 11 commits into from

Conversation

evantk91
Copy link
Contributor

@evantk91 evantk91 commented May 1, 2024

🔹 Jira Ticket(s) if any

✏️ Description

This pull request increases code coverage. Credit: Omni-CG.

@evantk91 evantk91 added the omni-cg PR's from OMNI CG label Jan 28, 2025
Copy link
Member

@Ayyanchira Ayyanchira left a 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

Comment on lines +132 to +146
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);
}
Copy link
Member

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.

Comment on lines +148 to +162
@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);
}
Copy link
Member

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

Comment on lines +172 to +179
public void testOnDestroy() {
if (htmlNotification.getActivity() != null && htmlNotification.getActivity().isChangingConfigurations()) {
return;
}
htmlNotification.onDestroy();
htmlNotification = null;
location = null;
}
Copy link
Member

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?

Comment on lines +187 to +196
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);
}
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
omni-cg PR's from OMNI CG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants