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

Integrating coverage plugin and adding unit tests - Sprint 1 #3802

Merged
merged 15 commits into from
Mar 14, 2017

Conversation

tharikaGitHub
Copy link
Member

No description provided.

@tharikaGitHub
Copy link
Member Author

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.*;
Copy link
Member

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.*;
Copy link
Member

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\"]}]");
Copy link
Member

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
Copy link
Member

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)
Copy link
Member

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);
Copy link
Member

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.*;
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix line length

@tharikaGitHub
Copy link
Member Author

Sure, will do the changes. Thanks for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants