Search in sources :

Example 1 with ParameterSetter

use of com.ibatis.sqlmap.client.extensions.ParameterSetter in project gocd by gocd.

the class BuildResultTypeHandlerCallbackTest method shouldReturnScheduledStringWhenGivenScheduled.

@Test
public void shouldReturnScheduledStringWhenGivenScheduled() throws SQLException {
    final ParameterSetter parameterSetter = context.mock(ParameterSetter.class);
    context.checking(new Expectations() {

        {
            one(parameterSetter).setString(JobResult.Failed.toString());
        }
    });
    callback.setParameter(parameterSetter, JobResult.Failed);
}
Also used : Expectations(org.jmock.Expectations) ParameterSetter(com.ibatis.sqlmap.client.extensions.ParameterSetter) Test(org.junit.Test)

Example 2 with ParameterSetter

use of com.ibatis.sqlmap.client.extensions.ParameterSetter in project gocd by gocd.

the class StageResultTypeHandlerCallbackTest method assertMaps.

private void assertMaps(final String str, StageResult value) throws SQLException {
    final ResultGetter resultGetter;
    Mockery context = new Mockery() {

        {
            setImposteriser(ClassImposteriser.INSTANCE);
        }
    };
    resultGetter = context.mock(ResultGetter.class);
    context.checking(new Expectations() {

        {
            one(resultGetter).getString();
            will(returnValue(str));
        }
    });
    StageResult result = (StageResult) callback.getResult(resultGetter);
    assertThat(result, is(equal(value)));
    final ParameterSetter parameterSetter = context.mock(ParameterSetter.class);
    context.checking(new Expectations() {

        {
            one(parameterSetter).setString(str);
        }
    });
    callback.setParameter(parameterSetter, value);
}
Also used : Expectations(org.jmock.Expectations) StageResult(com.thoughtworks.go.domain.StageResult) ParameterSetter(com.ibatis.sqlmap.client.extensions.ParameterSetter) ResultGetter(com.ibatis.sqlmap.client.extensions.ResultGetter) Mockery(org.jmock.Mockery)

Example 3 with ParameterSetter

use of com.ibatis.sqlmap.client.extensions.ParameterSetter in project gocd by gocd.

the class StageStateTypeHandlerCallbackTest method assertMaps.

private void assertMaps(final String str, StageState value) throws SQLException {
    final ResultGetter resultGetter;
    Mockery context = new Mockery() {

        {
            setImposteriser(ClassImposteriser.INSTANCE);
        }
    };
    resultGetter = context.mock(ResultGetter.class);
    context.checking(new Expectations() {

        {
            one(resultGetter).getString();
            will(returnValue(str));
        }
    });
    StageState result = (StageState) callback.getResult(resultGetter);
    assertThat(result, is(equal(value)));
    final ParameterSetter parameterSetter = context.mock(ParameterSetter.class);
    context.checking(new Expectations() {

        {
            one(parameterSetter).setString(str);
        }
    });
    callback.setParameter(parameterSetter, value);
}
Also used : Expectations(org.jmock.Expectations) StageState(com.thoughtworks.go.domain.StageState) ParameterSetter(com.ibatis.sqlmap.client.extensions.ParameterSetter) ResultGetter(com.ibatis.sqlmap.client.extensions.ResultGetter) Mockery(org.jmock.Mockery)

Example 4 with ParameterSetter

use of com.ibatis.sqlmap.client.extensions.ParameterSetter in project gocd by gocd.

the class BuildStateTypeHandlerCallbackTest method shouldReturnScheduledStringWhenGivenScheduled.

@Test
public void shouldReturnScheduledStringWhenGivenScheduled() throws SQLException {
    final ParameterSetter parameterSetter = context.mock(ParameterSetter.class);
    context.checking(new Expectations() {

        {
            one(parameterSetter).setString(JobState.Scheduled.toString());
        }
    });
    BuildStateTypeHandlerCallback callback = new BuildStateTypeHandlerCallback();
    callback.setParameter(parameterSetter, JobState.Scheduled);
}
Also used : Expectations(org.jmock.Expectations) ParameterSetter(com.ibatis.sqlmap.client.extensions.ParameterSetter) BuildStateTypeHandlerCallback(com.thoughtworks.go.server.dao.handlers.BuildStateTypeHandlerCallback) Test(org.junit.Test)

Aggregations

ParameterSetter (com.ibatis.sqlmap.client.extensions.ParameterSetter)4 Expectations (org.jmock.Expectations)4 ResultGetter (com.ibatis.sqlmap.client.extensions.ResultGetter)2 Mockery (org.jmock.Mockery)2 Test (org.junit.Test)2 StageResult (com.thoughtworks.go.domain.StageResult)1 StageState (com.thoughtworks.go.domain.StageState)1 BuildStateTypeHandlerCallback (com.thoughtworks.go.server.dao.handlers.BuildStateTypeHandlerCallback)1