/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
import com.att.research.xacml.api.Attribute;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.guard.OperationsHistory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@RunWith(MockitoJUnitRunner.class)
public class CountRecentOperationsPipTest {
private static final Logger LOGGER = LoggerFactory.getLogger(CountRecentOperationsPipTest.class);
*/
@Before
public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
-
when(pipRequest.getIssuer()).thenReturn("urn:org:onap:xacml:guard:tw:1:hour");
pipEngine = new MyPip();
properties.load(is);
}
- when(pipFinder.getMatchingAttributes(any(), eq(pipEngine))).thenReturn(resp1, resp2, resp3);
-
responses = new LinkedList<>(Arrays.asList(resp1, resp2, resp3));
attributes = new LinkedList<>(Arrays.asList(ACTOR, RECIPE, TARGET));
-
- when(resp1.getStatus()).thenReturn(okStatus);
- when(resp2.getStatus()).thenReturn(okStatus);
- when(resp3.getStatus()).thenReturn(okStatus);
-
- when(okStatus.isOk()).thenReturn(true);
}
@Test