Search code examples
javafitnesse

What would cause no rows in table exception?


I don't know where to starttrouble-shooting this. I'm wondering if I should try a different fixture test. I'm getting this error when I run my finesse test: fitnesse.fixtures.TestSecurityDaoFixtureTest

fit.exception.FitFailureException: There are no rows in this table at fitnesse.fixtures.TableFixture.doRows(TableFixture.java:15) at fit.Fixture.doTable(Fixture.java:154) at fitlibrary.traverse.FitHandler.doTable(Unknown Source) at fitlibrary.flow.DoFlowOnTable.runTable(Unknown Source) at fitlibrary.flow.DoFlowOnTable.runTable(Unknown Source) at fitlibrary.flow.DoFlow.runTable(Unknown Source) at fitlibrary.flow.DoFlow.runStorytest(Unknown Source) at fitlibrary.suite.BatchFitLibrary.doTables(Unknown Source) at fitlibrary.suite.BatchFitLibrary.doStorytest(Unknown Source) at fitlibrary.suite.BatchFitLibrary.doTables(Unknown Source) at fitlibrary.suite.FitLibraryServer.doTables(Unknown Source) at fitlibrary.suite.FitLibraryServer.doTables(Unknown Source) at fit.FitServerBridge.process(Unknown Source) at fit.FitServerBridge.run(Unknown Source) at fitlibrary.suite.FitLibraryServer.main(Unknown Source)

AND

FindSecurity Missing class or Missing method. Possibly:

public Type getFindSecurity() { }
public Type findSecurity() { }

Here is my actual code:

package fitnesse.fixtures;


import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.LocalDate;
import org.junit.BeforeClass;
import org.springframework.context.ApplicationContext;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;

import java.util.List;

/**
 * Created by V616248 on 12/17/2014.
 */
public class TestSomethingDaoFixtureTest extends BaseFixtureTest {

    private static ApplicationContext context;
    private static SomethingDao dao;

    private static Utility utility;

    @BeforeClass
    public void setUp() {
        System.out.println("in setup");
        utility= new Utility();
        utility.setUp();

    }

    /**
     *
     */
    public void findSomething(){
        System.out.println("Before find");
        List<Something> something1 = dao.findBySomethingCodeAndDate(getText(1, 0), new  
LocalDate());
        System.out.println("After find");
        if(something1 != null) {
            right(1, 0);
        } else {
            wrong(1, 0);
        }
        System.out.println("This is a test show results");
    }



    /**
     *
     * @param fitnessRows
     */
    public void showResults(int fitnessRows) {
        findSomething();

    }
}

My content.txt file: !|fitnesse.fixtures.TestSomethingDaoFixtureTest| !|FindSomething| |ABCD101|

Utility setup method:
public void setUp() {
        System.out.println("exception 1");
        context = UnitTestConfig.createApplicationContext();
        System.out.println("exception 2");
        categoryDao = context.getBean(CategoryDao.class);
        dao = context.getBean(SomethingDao.class);
        System.out.println("exception 3");
        PlatformTransactionManager tm = context.getBean(PlatformTransactionManager.class);
        System.out.println("exception 4");
        TransactionTemplate tt = new TransactionTemplate(tm);
        System.out.println("exception 5");

        tt.execute(new TransactionCallback<Void>() {
            @Override
            public Void doInTransaction(TransactionStatus status) {
                System.out.println("exception 6");
                DateTime currentDateTime = new DateTime(DateTimeZone.getDefault());
                System.out.println("exception 7");
                LocalDate localDate = new LocalDate();
                System.out.println("exception 8");
                Category inCategory = null;
                System.out.println("exception 9");
                try {
                    System.out.println("exception 10");
                    Category category = new Category("5d6d0db0-4d38-424d-8f82-14aab7798ad4", currentDateTime, "O607412",
                            "G-00A", "BEFORE ALLOC-FIRM LONG");
                    System.out.println("exception 11");
                    categoryDao.save(category);
                    System.out.println("exception 12");
                    inCategory = categoryDao.findOne(new Long(1));
                    System.out.println("exception 13");


                    System.out.println("exception 14");
                    Something something= new Something("1234",
                            currentDateTime,
                            "O607412",
                            localDate,
                            inCategory,
                            "ABCD101",
                            "Test 1",
                            new Double(100),
                            new Double(100),
                            new Double(0), false);
                    System.out.println("Now saving Something");
                    dao.save(something1);
                    System.out.println("After Save 1");

                    dao.save(something3);
                } catch (Exception e) {
                    e.printStackTrace();
                    System.out.println("exception" +e.toString());
                }
                return null;
            }
        });
}

Solution

  • I was trying to comment in the first cell of the first row. When I put real data in the first cell and the comment in the last cell, I had better luck. example: |!TestMyData|100| <-- didn't work |100|!TestMyData| <-- this worked