@@ -0,0 +1,3126 @@
+/*%0A * Copyright 2015, TeamDev Ltd. All rights reserved.%0A *%0A * Redistribution and use in source and/or binary forms, with or without%0A * modification, must retain the above copyright notice and the following%0A * disclaimer.%0A *%0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS%0A * %22AS IS%22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT%0A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR%0A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT%0A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,%0A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT%0A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,%0A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY%0A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT%0A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE%0A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A */%0A%0Apackage org.spine3.server.storage.datastore;%0A%0Aimport com.google.cloud.datastore.Entity;%0Aimport com.google.common.collect.Lists;%0Aimport com.google.protobuf.Message;%0Aimport org.junit.Test;%0Aimport org.spine3.protobuf.TypeUrl;%0Aimport org.spine3.test.Tests;%0Aimport org.spine3.test.storage.Project;%0A%0Aimport java.util.Collection;%0Aimport java.util.Collections;%0Aimport java.util.List;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.spine3.test.Verify.assertSize;%0A%0A/**%0A * @author Dmytro Dashenkov%0A */%0A@SuppressWarnings(%22InstanceMethodNamingConvention%22)%0Apublic class EntitiesUtilShould %7B%0A%0A    @Test%0A    public void have_private_constructor() %7B%0A        assertTrue(Tests.hasPrivateUtilityConstructor(Entities.class));%0A    %7D%0A%0A    @Test%0A    public void retrieve_default_message_instance_for_null_entity() %7B%0A        final TypeUrl typeUrl = TypeUrl.of(Project.getDescriptor());%0A        final Project expected = Project.getDefaultInstance();%0A        final Project actual = Entities.entityToMessage(null, typeUrl);%0A%0A        assertEquals(expected, actual);%0A    %7D%0A%0A    @Test%0A    public void retrieve_default_message_for_each_null_entity_in_collection() %7B%0A        final TypeUrl typeUrl = TypeUrl.of(Project.getDescriptor());%0A        final List%3CEntity%3E listOfNulls = Lists.newArrayList(null, null, null, null);%0A        final Collection%3CMessage%3E listOfDefaults = Entities.entitiesToMessages(listOfNulls, typeUrl);%0A        assertSize(listOfNulls.size(), listOfDefaults);%0A        final Project expectedValue = Project.getDefaultInstance();%0A        for (Message message : listOfDefaults) %7B%0A            assertEquals(expectedValue, message);%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void retrieve_empty_collection_on_empty_list() %7B%0A        final List%3CEntity%3E empty = Collections.emptyList();%0A        final TypeUrl typeUrl = TypeUrl.of(Project.getDescriptor());%0A        final Collection%3CMessage%3E converted = Entities.entitiesToMessages(empty, typeUrl);%0A        assertNotNull(converted);%0A        assertTrue(converted.isEmpty());%0A    %7D%0A%7D%0A

Add 'Entities' tests.