This file contains hidden or 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 interface MyTwitterApplicationContainer extends SparkApplicationContainer { | |
TweetsDb tweetsDb(); | |
} |
This file contains hidden or 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 SparkRunner extends BlockJUnit4ClassRunner { | |
private Class<? extends SparkApplicationContainer> applicationContainer; | |
/* ... */ | |
private void scanAnnotation() { | |
SparkApplicationTest annotation = getTestClass().getAnnotation(SparkApplicationTest.class); | |
applicationContainer = annotation.value(); | |
/* ... */ |
This file contains hidden or 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 FakeTweetsDb extends TweetsDb { | |
public List<Tweet> fetchTweets(long id, int count) { | |
return IntStream.range(0, 100) | |
.mapToObj((i) -> { | |
final Tweet tweet = new Tweet(); | |
tweet.id = id + i; | |
tweet.text = String.format("Mocked retweet of %s", id); | |
tweet.favorited = false; | |
tweet.user = new User(); |
This file contains hidden or 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
repositories { | |
mavenCentral() | |
maven { | |
url "http://repo.spring.io/release" | |
} | |
} | |
buildscript { | |
repositories { | |
mavenCentral() |
This file contains hidden or 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
import org.springframework.stereotype.Controller; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.ResponseBody; | |
@Controller | |
public class HelloController { | |
public String welcomeMessage = "Hello again!"; | |
@RequestMapping("hello") |
This file contains hidden or 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
Feature: Hello Testing | |
Scenario: Hello World API talks to us | |
When client calls GET /hello | |
Then response code is 200 | |
And response body is | |
""" | |
Hello again! | |
""" |
This file contains hidden or 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
import org.junit.runner.RunWith; | |
import cucumber.api.CucumberOptions; | |
import cucumber.api.junit.Cucumber; | |
@RunWith(Cucumber.class) | |
@CucumberOptions( | |
features = "src/test/resources/features", | |
monochrome = true, | |
plugin = {"pretty", "html:build/reports/cucumber"} |
This file contains hidden or 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
import org.springframework.boot.context.embedded.LocalServerPort; | |
import java.io.IOException; | |
import cucumber.api.java8.En; | |
import okhttp3.OkHttpClient; | |
import okhttp3.Request; | |
import okhttp3.Response; | |
import static org.assertj.core.api.Assertions.assertThat; |
This file contains hidden or 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
import org.springframework.boot.test.context.SpringBootTest; | |
import org.springframework.test.context.ContextConfiguration; | |
import cucumber.api.java8.En; | |
import spring.cucumber.demo.TwitterApp; | |
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | |
@ContextConfiguration(classes = TwitterApp.class) | |
public class AppSteps implements En { | |
} |
This file contains hidden or 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
import { Component } from '@angular/core' | |
@Component({ | |
selector: 'template-driven-form', | |
template: | |
` | |
<form #myForm="ngForm" (ngSubmit)="submit(myForm.form)"> | |
<div class="form-group"> | |
<label for="td_name" >Name</label> | |
<input type="text" class="form-control" id="td_name" |