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

templates.repository.sp.ProcedureTest.ftl Maven / Gradle / Ivy

Go to download

Maven plugin to generate Java classes from StoredProcedure and Functions in Database

There is a newer version: 1.8.20
Show newest version
package ${javaPackage}.repository.sp;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class ${proc.className}SPTest {

    @Mock
    private javax.sql.DataSource dataSource;

    @Mock
    private org.springframework.jdbc.core.JdbcTemplate jdbcTemplate;

    @Test
    public void test${proc.className}SPDataSource() throws java.sql.SQLException {

        Mockito.when(jdbcTemplate.getDataSource()).thenReturn(dataSource);

        ${proc.className}SPImpl sp = new ${proc.className}SPImpl(jdbcTemplate);

        Assert.assertSame(dataSource, sp.getJdbcTemplate().getDataSource());

        Assert.assertEquals("{<#if proc.function>? = call ${proc.fullName}(<#list proc.parameters as parameter><#if parameter.position != 0>?<#sep>, )}", sp.getCallString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy