@@ -0,0 +1,2534 @@
+package com.huskycode.jpaquery.solver;%0D%0A%0D%0Aimport static com.huskycode.jpaquery.command.CommandNodeFactory.n;%0D%0Aimport static com.huskycode.jpaquery.command.CommandNodesFactory.ns;%0D%0A%0D%0Aimport java.util.List;%0D%0A%0D%0Aimport org.junit.Before;%0D%0Aimport org.junit.Test;%0D%0A%0D%0Aimport junit.framework.Assert;%0D%0A%0D%0Aimport com.huskycode.jpaquery.DependenciesDefinition;%0D%0Aimport com.huskycode.jpaquery.command.CommandNodes;%0D%0Aimport com.huskycode.jpaquery.testmodel.pizza.Address;%0D%0Aimport com.huskycode.jpaquery.testmodel.pizza.Customer;%0D%0Aimport com.huskycode.jpaquery.testmodel.pizza.Employee;%0D%0Aimport com.huskycode.jpaquery.testmodel.pizza.PizzaOrder;%0D%0Aimport com.huskycode.jpaquery.testmodel.pizza.Vehicle;%0D%0Aimport com.huskycode.jpaquery.testmodel.pizza.deps.PizzaDeps;%0D%0A%0D%0Apublic class CommandInterpretorTest %7B%0D%0A%09%0D%0A%09private CommandPlan plan;%0D%0A%09private CommandNodes commands;%0D%0A%0D%0A%09@Before%0D%0A%09public void before() %7B%0D%0A%09%09DependenciesDefinition dependenciesDefinition = new PizzaDeps().getDepsUsingField();%0D%0A%09%09commands = ns(n(Address.class,%0D%0A%09%09%09%09%09%09%09%09%09n(PizzaOrder.class)));%0D%0A%09%09CommandInterpretor interpretor = CommandInterpretor.getInstance();%0D%0A%09%09plan = interpretor.createPlan(commands, dependenciesDefinition);%0D%0A%09%7D%0D%0A%09%0D%0A%09@Test%0D%0A%09public void testCreatePlanReturnPlanInCorrectOrderFromRootToLeave() %7B%0D%0A%09%09Assert.assertEquals(2, plan.getPlan().size());%0D%0A%09%09Assert.assertEquals(commands.get().get(0), plan.getPlan().get(0));%0D%0A%09%09Assert.assertEquals(commands.get().get(0).getChildren().get(0), plan.getPlan().get(1));%0D%0A%09%09%0D%0A%09%7D%0D%0A%09%0D%0A%09@Test%0D%0A%09public void testCreatePlanReturnCorrectInOrderEntityData() %7B%0D%0A%09%09InOrderEntityData inOrderData = plan.getInOrderEntityData();%0D%0A%09%09List%3CClass%3C?%3E%3E inOderEntities = inOrderData.getInOrderEntityList();%0D%0A%0D%0A%09%09Assert.assertEquals(5, inOrderData.getInOrderEntityList().size());%0D%0A%09%09Assert.assertTrue(inOrderData.getOrderIndexOf(Address.class) %3C 2);%0D%0A%09%09Assert.assertTrue(inOrderData.getOrderIndexOf(Vehicle.class) %3C 2);%0D%0A%09%09Assert.assertTrue(inOrderData.getOrderIndexOf(Customer.class) %3E 1);%0D%0A%09%09Assert.assertTrue(inOrderData.getOrderIndexOf(Employee.class) %3E 1);%0D%0A%09%09Assert.assertTrue(inOrderData.getOrderIndexOf(PizzaOrder.class) == 4);%0D%0A%09%09%0D%0A%09%09Assert.assertEquals(0, inOrderData.getOrderIndexOf(inOderEntities.get(0)));%0D%0A%09%09Assert.assertEquals(1, inOrderData.getOrderIndexOf(inOderEntities.get(1)));%0D%0A%09%09Assert.assertEquals(2, inOrderData.getOrderIndexOf(inOderEntities.get(2)));%0D%0A%09%09Assert.assertEquals(3, inOrderData.getOrderIndexOf(inOderEntities.get(3)));%0D%0A%09%09Assert.assertEquals(4, inOrderData.getOrderIndexOf(inOderEntities.get(4)));%0D%0A%09%7D%0D%0A%7D%0D%0A

add CommandInterpretorTest