go-pattern-examples/behavior/14_template_method/templatemethod_test.go
2020-04-21 22:53:23 +08:00

24 lines
535 B
Go

package templatemethod
func ExampleHTTPDownloader() {
var downloader Downloader = NewHTTPDownloader()
downloader.Download("http://example.com/abc.zip")
// Output:
// prepare downloading
// download http://example.com/abc.zip via http
// http save
// finish downloading
}
func ExampleFTPDownloader() {
var downloader Downloader = NewFTPDownloader()
downloader.Download("ftp://example.com/abc.zip")
// Output:
// prepare downloading
// download ftp://example.com/abc.zip via ftp
// default save
// finish downloading
}