use of com.thoughtworks.go.server.dao.handlers.BuildStateTypeHandlerCallback in project gocd by gocd.
the class BuildStateTypeHandlerCallbackTest method shouldReturnScheduledWhenGivenStringScheduled.
@Test
public void shouldReturnScheduledWhenGivenStringScheduled() throws SQLException {
context.checking(new Expectations() {
{
one(resultGetter).getString();
will(returnValue(JobState.Scheduled.toString()));
}
});
BuildStateTypeHandlerCallback callback = new BuildStateTypeHandlerCallback();
JobState result = (JobState) callback.getResult(resultGetter);
assertThat(result, is(equal(JobState.Scheduled)));
}
use of com.thoughtworks.go.server.dao.handlers.BuildStateTypeHandlerCallback in project gocd by gocd.
the class BuildStateTypeHandlerCallbackTest method shouldReturnStateWithStringColumnName.
@Test
public void shouldReturnStateWithStringColumnName() throws SQLException {
ResultSet rs = mock(ResultSet.class);
when(rs.getString("foo")).thenReturn(JobState.Scheduled.toString());
BuildStateTypeHandlerCallback callback = new BuildStateTypeHandlerCallback(JobState.class);
JobState result = callback.getResult(rs, "foo");
assertThat(result, is(JobState.Scheduled));
}
use of com.thoughtworks.go.server.dao.handlers.BuildStateTypeHandlerCallback in project gocd by gocd.
the class BuildStateTypeHandlerCallbackTest method shouldReturnStateWithIntegerColumnNameAndCallableStatement.
@Test
public void shouldReturnStateWithIntegerColumnNameAndCallableStatement() throws SQLException {
CallableStatement rs = mock(CallableStatement.class);
when(rs.getString(42)).thenReturn(JobState.Scheduled.toString());
BuildStateTypeHandlerCallback callback = new BuildStateTypeHandlerCallback(JobState.class);
JobState result = callback.getResult(rs, 42);
assertThat(result, is(JobState.Scheduled));
}
use of com.thoughtworks.go.server.dao.handlers.BuildStateTypeHandlerCallback 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);
}
use of com.thoughtworks.go.server.dao.handlers.BuildStateTypeHandlerCallback in project gocd by gocd.
the class BuildStateTypeHandlerCallbackTest method shouldReturnStateWithIntegerColumnName.
@Test
public void shouldReturnStateWithIntegerColumnName() throws SQLException {
ResultSet rs = mock(ResultSet.class);
when(rs.getString(42)).thenReturn(JobState.Scheduled.toString());
BuildStateTypeHandlerCallback callback = new BuildStateTypeHandlerCallback(JobState.class);
JobState result = callback.getResult(rs, 42);
assertThat(result, is(JobState.Scheduled));
}
Aggregations