/*- * ============LICENSE_START======================================================= * Simulator * ================================================================================ * Copyright (C) 2019 Nokia. 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. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= */ package org.onap.integration.simulators.nfsimulator.vesclient.template; import com.google.gson.Gson; import com.google.gson.JsonObject; import org.assertj.core.api.Assertions; import org.assertj.core.util.Lists; import org.bson.Document; import org.junit.Assert; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.onap.integration.simulators.nfsimulator.vesclient.template.search.TemplateSearchHelper; import org.onap.integration.simulators.nfsimulator.vesclient.template.search.viewmodel.FlatTemplateContent; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.query.Query; import java.time.Instant; import java.util.Collections; import java.util.List; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; class TemplateServiceTest { private static final Gson GSON = new Gson(); private static final Template SAMPLE_TEMPLATE = new Template("sample name", new Document(), Instant.now().getNano()); private static final List