diff --git a/terraform/ui_output.go b/terraform/ui_output.go new file mode 100644 index 000000000..84427c63d --- /dev/null +++ b/terraform/ui_output.go @@ -0,0 +1,7 @@ +package terraform + +// UIOutput is the interface that must be implemented to output +// data to the end user. +type UIOutput interface { + Output(string) +} diff --git a/terraform/ui_output_mock.go b/terraform/ui_output_mock.go new file mode 100644 index 000000000..8e6ff82d7 --- /dev/null +++ b/terraform/ui_output_mock.go @@ -0,0 +1,16 @@ +package terraform + +// MockUIOutput is an implementation of UIOutput that can be used for tests. +type MockUIOutput struct { + OutputCalled bool + OutputMessage string + OutputFn func(string) +} + +func (o *MockUIOutput) Output(v string) { + o.OutputCalled = true + o.OutputMessage= v + if o.OutputFn == nil { + o.OutputFn(v) + } +} diff --git a/terraform/ui_output_mock_test.go b/terraform/ui_output_mock_test.go new file mode 100644 index 000000000..0a23c2e23 --- /dev/null +++ b/terraform/ui_output_mock_test.go @@ -0,0 +1,9 @@ +package terraform + +import ( + "testing" +) + +func TestMockUIOutput(t *testing.T) { + var _ UIOutput = new(MockUIOutput) +}