All Downloads are FREE. Search and download functionalities are using the official Maven repository.

t.greendao-generator.3.2.0.source-code.dao-unit-test.ftl Maven / Gradle / Ivy

There is a newer version: 3.3.0
Show newest version
<#--

Copyright (C) 2011 Markus Junginger, greenrobot (http://greenrobot.de)     
                                                                           
This file is part of greenDAO Generator.                                   
                                                                           
greenDAO Generator is free software: you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by       
the Free Software Foundation, either version 3 of the License, or          
(at your option) any later version.                                        
greenDAO Generator is distributed in the hope that it will be useful,      
but WITHOUT ANY WARRANTY; without even the implied warranty of             
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
GNU General Public License for more details.                               
                                                                           
You should have received a copy of the GNU General Public License          
along with greenDAO Generator.  If not, see .

-->
package ${entity.javaPackageTest};

<#assign isStringPK = entity.pkProperty?? && entity.pkProperty.propertyType == "String" />
<#if isStringPK>
import org.greenrobot.greendao.test.AbstractDaoTestStringPk;
<#else>
import org.greenrobot.greendao.test.AbstractDaoTestLongPk;


import ${entity.javaPackage}.${entity.className};
import ${entity.javaPackageDao}.${entity.classNameDao};

public class ${entity.classNameTest} extends <#if
isStringPK>AbstractDaoTestStringPk<${entity.classNameDao}, ${entity.className}><#else>AbstractDaoTestLongPk<${entity.classNameDao}, ${entity.className}> {

    public ${entity.classNameTest}() {
        super(${entity.classNameDao}.class);
    }

    @Override
    protected ${entity.className} createEntity(<#if isStringPK>String<#else>Long key) {
        ${entity.className} entity = new ${entity.className}();
<#if entity.pkProperty??>
        entity.set${entity.pkProperty.propertyName?cap_first}(key);

<#list entity.properties as property>
<#if property.notNull>
        entity.set${property.propertyName?cap_first}();
 

        return entity;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy