This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copied from their sample project | |
# https://github.com/CircleCI-Public/circleci-demo-go/blob/master/.circleci/config.yml | |
version: 2 | |
jobs: | |
build: | |
docker: | |
# CircleCI Go images available at: https://hub.docker.com/r/circleci/golang/ | |
- image: circleci/golang:1.8 | |
# CircleCI MySQL images available at: https://hub.docker.com/r/circleci/mysql/ | |
- image: circleci/mysql:5.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine: | |
environment: | |
PROJECT_GOPATH: "${HOME}/.go_project" | |
PROJECT_PARENT_PATH: "${PROJECT_GOPATH}/src/github.com/welnys" | |
PROJECT_PATH: "${PROJECT_PARENT_PATH}/${CIRCLE_PROJECT_REPONAME}" | |
GOPATH: "${HOME}/.go_workspace:/usr/local/go_workspace:${PROJECT_GOPATH}" | |
dependencies: | |
pre: | |
- go get -u github.com/kardianos/govendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Rule | |
public final TestComponentRule component = new TestComponentRule.Builder() | |
.withUserManager(true) | |
.build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Rule | |
public final TestComponentRule component = new TestComponentRule.Builder() | |
.withClient() | |
.withUserManager(false) | |
.build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Builder withClient() { | |
this.testClient = new TestGiphyClient(); | |
return this; | |
} | |
public Builder withUserManager(boolean real) { | |
if (real) { | |
this.userManager = new UserManagerImpl(); | |
} else { | |
this.userManager = new TestUserManager(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Needed to replace the component with a test specific one | |
@VisibleForTesting | |
public void setComponent(ApplicationComponent applicationComponent) { | |
this.applicationComponent = applicationComponent; | |
// we need to inject again, otherwise the objects here are the originals | |
// not the test ones as one would expect R.Pina 20160105 | |
this.applicationComponent.inject(this); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final TestComponentRule component = new TestComponentRule.Builder() | |
.withClient() | |
.withUserManager(true) | |
.build(); | |
public final ActivityTestRule<MainActivity> activity = new ActivityTestRule<>( | |
MainActivity.class, | |
false, | |
false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseTest { | |
public List<Giphy> getGiphies(int count) { | |
List<Giphy> list = new ArrayList<>(); | |
for (int i = count; i > 0; i--) { | |
list.add(new Giphy.Builder().url("some_url_" + i).build()); | |
} | |
return list; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestComponentRule implements TestRule { | |
private ApplicationTestModule module; | |
private TestComponent testComponent; | |
private TestComponentRule(ApplicationTestModule applicationTestModule) { | |
this.module = applicationTestModule; | |
} | |
private void setupDaggerTestComponentInApplication() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task incrementVersion << { | |
def propsFile = file("../gradle.properties") | |
def propsText = propsFile.getText() | |
def patternVersionNumber = Pattern.compile("app_version=(\\d+)\\.(\\d+)\\.(\\d+)") | |
def matcherVersionNumber = patternVersionNumber.matcher(propsText) | |
matcherVersionNumber.find() | |
def majorVersion = Integer.parseInt(matcherVersionNumber.group(1)) | |
def minorVersion = Integer.parseInt(matcherVersionNumber.group(2)) |