Search in sources :

Example 1 with APIRating

use of org.wso2.carbon.apimgt.api.model.APIRating in project carbon-apimgt by wso2.

the class APIConsumerImplTest method testRateAPI.

@Test
public void testRateAPI() throws APIManagementException {
    String uuid = UUID.randomUUID().toString();
    APIRating apiRating = APIRating.RATING_FOUR;
    String user = "Tom";
    APIConsumerImpl apiConsumer = new APIConsumerImplWrapper(apiMgtDAO);
    Mockito.doNothing().when(apiMgtDAO).addRating(uuid, apiRating.getRating(), user);
    apiConsumer.rateAPI(uuid, apiRating, user);
    Mockito.verify(apiMgtDAO, Mockito.times(1)).addRating(uuid, apiRating.getRating(), user);
}
Also used : APIRating(org.wso2.carbon.apimgt.api.model.APIRating) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 APIRating (org.wso2.carbon.apimgt.api.model.APIRating)1