@@ -0,0 +1,1697 @@
+package net.q3aiml.dbdata.morph;%0A%0Aimport com.google.common.collect.ImmutableList;%0Aimport com.google.common.collect.ImmutableMap;%0Aimport net.q3aiml.dbdata.DataSpec;%0Aimport net.q3aiml.dbdata.model.DatabaseMetadata;%0Aimport net.q3aiml.dbdata.model.Table;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport static java.util.Arrays.asList;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Apublic class SortDataSpecTest %7B%0A    DatabaseMetadata db = mock(DatabaseMetadata.class);%0A    Table beforeTable = new Table(null, %22before%22);%0A    Table afterTable = new Table(null, %22after%22);%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        when(db.tableByNameNoCreate(%22before%22)).thenReturn(beforeTable);%0A        when(db.tableByNameNoCreate(%22after%22)).thenReturn(afterTable);%0A    %7D%0A%0A    @Test%0A    public void sortRowTablesTest() %7B%0A        when(db.tablesOrderedByReferences()).thenReturn(ImmutableList.of(beforeTable, afterTable));%0A        DataSpec dataSpec = new DataSpec();%0A        DataSpec.DataSpecRow afterRow = new DataSpec.DataSpecRow(%22after%22, ImmutableMap.of());%0A        DataSpec.DataSpecRow beforeRow = new DataSpec.DataSpecRow(%22before%22, ImmutableMap.of());%0A        dataSpec.tableRows.add(afterRow);%0A        dataSpec.tableRows.add(beforeRow);%0A        new SortDataSpec().sortRowTables(dataSpec, db);%0A        assertEquals(asList(beforeRow, afterRow), dataSpec.tableRows);%0A    %7D%0A%0A    @Test%0A    public void sortRowTablesEmptyTest() %7B%0A        when(db.tablesOrderedByReferences()).thenReturn(ImmutableList.of());%0A        DataSpec dataSpec = new DataSpec();%0A        new SortDataSpec().sortRowTables(dataSpec, db);%0A    %7D%0A%7D%0A

test SortDataSpec