0

I am trying to use DBSetup for my testing. I was able to make it run with simple Inserts:

public static final Operation INSERT_CURRENCY_DATA = 
    Insert.into("CURRENCY")
        .columns("ID", "CODE", "NAME", "DESCRIPTION")
        .values(1, "EUR", "EUR", "EUR")
        .values(2, "CZK", "CZK", "CZK")
        .build();

But when one table has a foreign key in another table like the example below from the website:

Operation insertVendorsAndProducts = 
    sequenceOf(
        insertInto("VENDOR")
            .columns("ID", "CODE", "NAME")
            .values(1L, "AMA", "AMAZON")
            .build(),
        insertInto("PRODUCT")
            .columns("ID", "NAME", "VENDOR_ID")
            .values(1L, "Kindle", "1L")
            .build(),
        sql("update VENDOR set FEATURED_PRODUCT_ID = 1 where ID = 1"));

I could not compile the code and getting Syntax error on token ',',.expected in the .build(), line

theresa
  • 11
  • 3
  • Please post a complete example, from the very first import statement to the last line of the class. This compiles fine here: https://gist.github.com/jnizet/b0a5152a1fbf96f17ddf. Also, post the exact and complete error message, and tell us which line it refers to. – JB Nizet Feb 11 '15 at 13:24
  • Ah now it worked. It does not work in the CommonOperations.java, but it works when I add the import import static com.ninja_squad.dbsetup.Operations.sql; in the test class. – theresa Feb 11 '15 at 13:55

0 Answers0