use of io.gravitee.rest.api.service.impl.swagger.policy.PolicyOperationVisitor in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPITest method setup.
@Before
public void setup() {
PolicyOperationVisitor swaggerPolicyOperationVisitor = mock(PolicyOperationVisitor.class);
when(swaggerPolicyOperationVisitor.getId()).thenReturn("mock");
PolicyOperationVisitor oaiPolicyOperationVisitor = mock(PolicyOperationVisitor.class);
when(oaiPolicyOperationVisitor.getId()).thenReturn("mock");
io.gravitee.policy.api.swagger.v3.OAIOperationVisitor oaiPolicyOperationVisitorImpl = mock(io.gravitee.policy.api.swagger.v3.OAIOperationVisitor.class);
when(policyOperationVisitorManager.getPolicyVisitors()).thenReturn(asList(swaggerPolicyOperationVisitor, oaiPolicyOperationVisitor));
OAIOperationVisitor op = mock(OAIPolicyOperationVisitor.class);
when(op.visit(any(), any())).thenReturn(Optional.of(new Policy()));
when(policyOperationVisitorManager.getOAIOperationVisitor(anyString())).thenReturn(op);
GroupEntity grp1 = new GroupEntity();
grp1.setId("group1");
GroupEntity grp2 = new GroupEntity();
grp2.setId("group2");
when(groupService.findByName("group1")).thenReturn(Arrays.asList(grp1));
when(groupService.findByName("group2")).thenReturn(Arrays.asList(grp2));
TagEntity tag1 = new TagEntity();
tag1.setId("tagId1");
tag1.setName("tag1");
TagEntity tag2 = new TagEntity();
tag2.setId("tagId2");
tag2.setName("tag2");
when(tagService.findByReference(any(), any())).thenReturn(Arrays.asList(tag1, tag2));
}
Aggregations