Scopri come trovare DJ vintage e rendere il tuo evento unico e indimenticabile. In questo articolo, esploreremo i migliori consigli per selezionare il DJ perfetto, le caratteristiche da considerare e come creare l'atmosfera giusta per ogni occasione. Non perdere l'opportunità di avere il sound che desideri!
Trova professionisti vicino a te
Trova professionisti
/*
* Copyright (C) 2012-2014 DuyHai DOAN
*
* 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.
*/
package info.archinnov.achilles.internal.statement.cache;
import static info.archinnov.achilles.internal.metadata.holder.PropertyType.SIMPLE;
import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import com.datastax.driver.core.ColumnMetadata;
import com.datastax.driver.core.DataType;
import com.datastax.driver.core.TableMetadata;
import info.archinnov.achilles.internal.metadata.holder.PropertyMeta;
import info.archinnov.achilles.test.mapping.entity.ClusteredEntity;
@RunWith(MockitoJUnitRunner.class)
public class SimplePropertyCacheKeyTest {
@Mock
private PropertyMeta propertyMeta;
@Mock
private TableMetadata tableMeta;
@Mock
private ColumnMetadata columnMeta;
@Mock
private DataType dataType;
private String propertyName = "age";
private SimplePropertyCacheKey key;
@Before
public void setUp() {
when(propertyMeta.type()).thenReturn(SIMPLE);
when(propertyMeta.getTableName()).thenReturn(ClusteredEntity.class.getCanonicalName());
when(propertyMeta.getTableMetadata()).thenReturn(tableMeta);
when(propertyMeta.getPropertyName()).thenReturn(propertyName);
when(propertyMeta.getCQLColumnName()).thenReturn(propertyName);
when(tableMeta.getColumn(propertyName)).thenReturn(columnMeta);
when(columnMeta.getType()).thenReturn(dataType);
key = new SimplePropertyCacheKey(propertyMeta);
}
@Test
public void should_generate_id() throws Exception {
//Given
UUID uuid = UUID.randomUUID();
when(dataType.getName()).thenReturn(DataType.Name.UUID);
when(dataType.getTypeArguments()).thenReturn(null);
//When
final CacheKey actual = key.createValue(uuid);
//Then
final CacheKey expected = new CacheKey(ClusteredEntity.class.getCanonicalName(), propertyName, uuid);
assertThat(actual).isEqualTo(expected);
}
}