-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
96 additions
and
35 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
43 changes: 43 additions & 0 deletions
43
moco-runner/src/test/java/com/github/dreamhead/moco/runner/FileRunnerTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.github.dreamhead.moco.runner; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
|
||
import java.io.File; | ||
|
||
import static com.github.dreamhead.moco.bootstrap.arg.HttpArgs.httpArgs; | ||
import static com.github.dreamhead.moco.helper.RemoteTestUtils.*; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.junit.Assert.assertThat; | ||
|
||
public class FileRunnerTest extends AbstractRunnerTest { | ||
|
||
@Rule | ||
public TemporaryFolder tempFolder = new TemporaryFolder(); | ||
|
||
@Test | ||
public void should_load_configurations() throws Exception { | ||
final File config1 = tempFolder.newFile(); | ||
changeFileContent(config1, "[{\"response\" :{" | ||
+ "\"text\" : \"foo\"" | ||
+ "}}]"); | ||
|
||
final File config2 = tempFolder.newFile(); | ||
changeFileContent(config2, "[{" + | ||
"\"request\": {\"uri\": \"/bar\"}," + | ||
"\"response\": {\"text\": \"bar\"}" + | ||
"}]"); | ||
|
||
RunnerFactory factory = new RunnerFactory("SHUTDOWN"); | ||
runner = factory.createRunner(httpArgs() | ||
.withPort(port()) | ||
.withShutdownPort(9090) | ||
.withConfigurationFile(config1.getAbsolutePath(), config2.getAbsolutePath()) | ||
.build()); | ||
runner.run(); | ||
|
||
assertThat(helper.get(root()), is("foo")); | ||
assertThat(helper.get(remoteUrl("/bar")), is("bar")); | ||
} | ||
} |