package test.org.itscool.commons.dao;

import junit.framework.TestCase;
import org.itscool.commons.dao.*;

public class Criteria4Test extends TestCase{
    public void testSelect4(){
        Criteria crt = new Criteria(BookBean1.class);
        //System.out.println("------------------------------");
        //System.out.println(crt.toSelectString());
        String line = System.getProperty("line.separator");
        StringBuffer sb = new StringBuffer();
        sb.append("SELECT").append(line);
        sb.append("    BOOK.ID as BOOK_ID,").append(line);
        sb.append("    BOOK.NAME as BOOK_NAME,").append(line);
        sb.append("    BOOK.AUTOR_ID as BOOK_AUTOR_ID").append(line);
        sb.append("FROM").append(line);
        sb.append("    BOOK");
        if(!sb.toString().equals(crt.toSelectString())){
            System.out.println("** testSelect4() ** ");
            System.out.println("test->"+sb.toString());
            System.out.println("result->"+crt.toSelectString());
        }
        assertEquals(sb.toString(), crt.toSelectString());
    }
    public void testSelect4Ex(){
        Criteria crt = new Criteria(BookBean1Ex.class);
        //System.out.println("------------------------------");
        //System.out.println(crt.toSelectString());
        String line = System.getProperty("line.separator");
        StringBuffer sb = new StringBuffer();
        sb.append("SELECT").append(line);
        sb.append("    BOOK.ID as BOOK_ID,").append(line);
        sb.append("    BOOK.NAME as BOOK_NAME,").append(line);
        sb.append("    BOOK.ISDN as BOOK_ISDN,").append(line);
        sb.append("    BOOK.AUTOR_ID as BOOK_AUTOR_ID").append(line);
        sb.append("FROM").append(line);
        sb.append("    BOOK");
        if(!sb.toString().equals(crt.toSelectString())){
            System.out.println("** testSelect4Ex() ** ");
            System.out.println("test->"+sb.toString());
            System.out.println("result->"+crt.toSelectString());
        }
        assertEquals(sb.toString(), crt.toSelectString());
    }
}
