Commit 5b998717e79f7fcde249b9a0a3686a2c0f5be68e

Authored by Igor Kulikov
1 parent 26f0e484

Remove invalid test

1   -/**
2   - * ThingsBoard, Inc. ("COMPANY") CONFIDENTIAL
3   - *
4   - * Copyright © 2016-2021 ThingsBoard, Inc. All Rights Reserved.
5   - *
6   - * NOTICE: All information contained herein is, and remains
7   - * the property of ThingsBoard, Inc. and its suppliers,
8   - * if any. The intellectual and technical concepts contained
9   - * herein are proprietary to ThingsBoard, Inc.
10   - * and its suppliers and may be covered by U.S. and Foreign Patents,
11   - * patents in process, and are protected by trade secret or copyright law.
12   - *
13   - * Dissemination of this information or reproduction of this material is strictly forbidden
14   - * unless prior written permission is obtained from COMPANY.
15   - *
16   - * Access to the source code contained herein is hereby forbidden to anyone except current COMPANY employees,
17   - * managers or contractors who have executed Confidentiality and Non-disclosure agreements
18   - * explicitly covering such access.
19   - *
20   - * The copyright notice above does not evidence any actual or intended publication
21   - * or disclosure of this source code, which includes
22   - * information that is confidential and/or proprietary, and is a trade secret, of COMPANY.
23   - * ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC PERFORMANCE,
24   - * OR PUBLIC DISPLAY OF OR THROUGH USE OF THIS SOURCE CODE WITHOUT
25   - * THE EXPRESS WRITTEN CONSENT OF COMPANY IS STRICTLY PROHIBITED,
26   - * AND IN VIOLATION OF APPLICABLE LAWS AND INTERNATIONAL TREATIES.
27   - * THE RECEIPT OR POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION
28   - * DOES NOT CONVEY OR IMPLY ANY RIGHTS TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS,
29   - * OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR IN PART.
30   - */
31   -package org.thingsboard.server.dao.attributes;
32   -
33   -import com.google.common.util.concurrent.MoreExecutors;
34   -import org.junit.Test;
35   -import org.thingsboard.server.dao.cache.CacheConfiguration;
36   -import org.thingsboard.server.dao.cache.CacheExecutorService;
37   -
38   -import static org.hamcrest.CoreMatchers.is;
39   -import static org.hamcrest.MatcherAssert.assertThat;
40   -import static org.mockito.ArgumentMatchers.any;
41   -import static org.mockito.BDDMockito.willCallRealMethod;
42   -import static org.mockito.Mockito.mock;
43   -
44   -public class CachedAttributesServiceTest {
45   -
46   - public static final String REDIS = "redis";
47   -
48   - @Test
49   - public void givenLocalCacheTypeName_whenEquals_thenOK() {
50   - assertThat(CachedAttributesService.LOCAL_CACHE_TYPE, is("caffeine"));
51   - }
52   -
53   - @Test
54   - public void givenCacheType_whenGetExecutor_thenDirectExecutor() {
55   - CachedAttributesService cachedAttributesService = mock(CachedAttributesService.class);
56   - CacheExecutorService cacheExecutorService = mock(CacheExecutorService.class);
57   - willCallRealMethod().given(cachedAttributesService).getExecutor(any(), any());
58   -
59   - assertThat(cachedAttributesService.getExecutor(null, cacheExecutorService), is(MoreExecutors.directExecutor()));
60   -
61   - CacheConfiguration cacheConfiguration = new CacheConfiguration();
62   - cacheConfiguration.setType(null);
63   - assertThat(cachedAttributesService.getExecutor(cacheConfiguration, cacheExecutorService), is(MoreExecutors.directExecutor()));
64   -
65   - cacheConfiguration.setType("");
66   - assertThat(cachedAttributesService.getExecutor(cacheConfiguration, cacheExecutorService), is(MoreExecutors.directExecutor()));
67   -
68   - cacheConfiguration.setType(CachedAttributesService.LOCAL_CACHE_TYPE);
69   - assertThat(cachedAttributesService.getExecutor(cacheConfiguration, cacheExecutorService), is(MoreExecutors.directExecutor()));
70   -
71   - }
72   -
73   - @Test
74   - public void givenCacheType_whenGetExecutor_thenReturnCacheExecutorService() {
75   - CachedAttributesService cachedAttributesService = mock(CachedAttributesService.class);
76   - CacheExecutorService cacheExecutorService = mock(CacheExecutorService.class);
77   - willCallRealMethod().given(cachedAttributesService).getExecutor(any(CacheConfiguration.class), any(CacheExecutorService.class));
78   -
79   - CacheConfiguration cacheConfiguration = new CacheConfiguration();
80   - cacheConfiguration.setType(REDIS);
81   - assertThat(cachedAttributesService.getExecutor(cacheConfiguration, cacheExecutorService), is(cacheExecutorService));
82   -
83   - cacheConfiguration.setType("unknownCacheType");
84   - assertThat(cachedAttributesService.getExecutor(cacheConfiguration, cacheExecutorService), is(cacheExecutorService));
85   -
86   - }
87   -
88   -}
\ No newline at end of file