-
Notifications
You must be signed in to change notification settings - Fork 622
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
Integrating coverage plugin and adding unit tests - Sprint 1 #3802
Conversation
The check on the 70% code coverage has been commented out so that the build wont break until the coverage goal is met. |
import org.wso2.carbon.apimgt.core.dao.ApplicationDAO; | ||
import org.wso2.carbon.apimgt.core.dao.PolicyDAO; | ||
import org.wso2.carbon.apimgt.core.dao.TagDAO; | ||
import org.wso2.carbon.apimgt.core.dao.*; |
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.
remove wild card imports
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
import static org.mockito.Mockito.*; |
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.
same here
@@ -132,13 +138,116 @@ public void testAddApplication() throws APIManagementException { | |||
APIStore apiStore = new APIStoreImpl(USER_NAME, null, applicationDAO, null, policyDAO, null, null); | |||
Application application = new Application(APP_NAME, USER_NAME); | |||
application.setTier(TIER); | |||
application.setPermissionString("[{\"groupId\": \"testGroup\",\"permission\":[\"READ\",\"UPDATE\",\"DELETE\",\"SUBSCRIPTION\"]}]"); |
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.
line length too long? which is 120 by defualt
* Tests to catch exceptions in methods | ||
*/ | ||
|
||
//Cannot be caught because the subscriptionID is randomly generated inside the method |
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.
can we remove the commented out code?
apiStore.getAllTags(); | ||
} | ||
|
||
@Test(description = "Exception when getting all policies of a specific policy level", expectedExceptions = APIMgtDAOException.class) |
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.
line length too long
application.setTier(TIER); | ||
when(applicationDAO.isApplicationNameExists(APP_NAME)).thenReturn(false); | ||
when(policyDAO.getPolicy(APIMgtConstants.ThrottlePolicyConstants.APPLICATION_LEVEL, TIER)).thenReturn(policy); | ||
doThrow(new APIMgtDAOException("Error occurred while creating the application - " + application.getName())).when(applicationDAO).addApplication(application); |
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.
line length. Please fix in other places as well
import static org.mockito.Mockito.times; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
import static org.mockito.Mockito.*; |
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.
remove wild card imports
* Test cases for exceptions | ||
*/ | ||
|
||
@Test(description = "Exception when retrieving an application by uuid", expectedExceptions = APIMgtDAOException.class) |
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.
fix line length
Sure, will do the changes. Thanks for the review. |
No description provided.