2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.facade.operations;
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.junit.runner.RunWith;
26 import org.mockito.ArgumentCaptor;
27 import org.mockito.Captor;
28 import org.mockito.Mock;
29 import org.mockito.Mockito;
30 import org.mockito.junit.MockitoJUnitRunner;
31 import org.openecomp.sdc.be.catalog.impl.DmaapProducer;
32 import org.openecomp.sdc.be.user.UserMessage;
33 import org.openecomp.sdc.be.user.UserOperationEnum;
35 import static org.assertj.core.api.Assertions.assertThat;
37 @RunWith(MockitoJUnitRunner.class)
38 public class FacadeUserCacheOperationTest {
40 private DmaapProducer msProducer;
42 private ArgumentCaptor<UserMessage> messageCaptor;
44 private UserOperation userCacheOperation;
48 userCacheOperation = new UserOperation(msProducer);
52 public void testUpdate() {
53 userCacheOperation.updateUserCache(UserOperationEnum.CREATE, "id", "role");
54 Mockito.verify(msProducer).pushMessage(messageCaptor.capture());
56 UserMessage message = messageCaptor.getValue();
58 assertThat(message.getOperation()).isEqualTo(UserOperationEnum.CREATE);
59 assertThat(message.getUserId()).isEqualTo("id");
60 assertThat(message.getRole()).isEqualTo("role");