// Path: neo4j/src/test/java/eu/drus/jpa/unit/neo4j/test/entities/B.java
// @Entity
// public class B {
// 
//     @Id
//     private Long id;
// }


import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
import org.jgrapht.Graph;
import org.jgrapht.graph.ClassBasedEdgeFactory;
import org.jgrapht.graph.DefaultDirectedGraph;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import com.google.common.collect.ImmutableMap;
import eu.drus.jpa.unit.neo4j.dataset.Edge;
import eu.drus.jpa.unit.neo4j.dataset.GraphElementFactory;
import eu.drus.jpa.unit.neo4j.dataset.Node;
import eu.drus.jpa.unit.neo4j.test.entities.A;
import eu.drus.jpa.unit.neo4j.test.entities.B;
package eu.drus.jpa.unit.neo4j.operation;






@RunWith(MockitoJUnitRunner.class)
public class RefreshOperationTest {

    private GraphElementFactory graphElementFactory;

    @Mock
    private Connection connection;

    @Spy
    private RefreshOperation operation;

    @Before
    public void prepareMocks() throws SQLException {
        doAnswer(i -> null).when(operation).executeQuery(any(Connection.class), anyString());

        graphElementFactory = new GraphElementFactory(Arrays.asList(A.class, B.class));
    }

    @Test
    public void testExecute() throws Exception {
        // GIVEN
        final Node n1 = graphElementFactory.createNode("n1", Arrays.asList("A"),
                ImmutableMap.<String, Object>builder().put("id", 1l).put("value", "A").build());
        final Node n2 = graphElementFactory.createNode("n2", Arrays.asList("A"),
                ImmutableMap.<String, Object>builder().put("id", 2l).build());
// Path: neo4j/src/test/java/eu/drus/jpa/unit/neo4j/test/entities/B.java
// @Entity
// public class B {
// 
//     @Id
//     private Long id;
// }


// Path: neo4j/src/test/java/eu/drus/jpa/unit/neo4j/operation/RefreshOperationTest.java
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
import org.jgrapht.Graph;
import org.jgrapht.graph.ClassBasedEdgeFactory;
import org.jgrapht.graph.DefaultDirectedGraph;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import com.google.common.collect.ImmutableMap;
import eu.drus.jpa.unit.neo4j.dataset.Edge;
import eu.drus.jpa.unit.neo4j.dataset.GraphElementFactory;
import eu.drus.jpa.unit.neo4j.dataset.Node;
import eu.drus.jpa.unit.neo4j.test.entities.A;
import eu.drus.jpa.unit.neo4j.test.entities.B;

package eu.drus.jpa.unit.neo4j.operation;






@RunWith(MockitoJUnitRunner.class)
public class RefreshOperationTest {

    private GraphElementFactory graphElementFactory;

    @Mock
    private Connection connection;

    @Spy
    private RefreshOperation operation;

    @Before
    public void prepareMocks() throws SQLException {
        doAnswer(i -> null).when(operation).executeQuery(any(Connection.class), anyString());

        graphElementFactory = new GraphElementFactory(Arrays.asList(A.class, B.class));
    }

    @Test
    public void testExecute() throws Exception {
        // GIVEN
        final Node n1 = graphElementFactory.createNode("n1", Arrays.asList("A"),
                ImmutableMap.<String, Object>builder().put("id", 1l).put("value", "A").build());
        final Node n2 = graphElementFactory.createNode("n2", Arrays.asList("A"),
                ImmutableMap.<String, Object>builder().put("id", 2l).build());
        final Edge e1 = graphElementFactory.createEdge(n1, n2, "e1", Arrays.asList("E"),