Last active
December 31, 2015 15:39
-
-
Save rschumm/8008240 to your computer and use it in GitHub Desktop.
restfuse einfacher Integrationstest für RESTful Services
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
<dependency> | |
<groupId>com.restfuse</groupId> | |
<artifactId>com.eclipsesource.restfuse</artifactId> | |
<version>1.2.0</version> | |
<scope>test</scope> | |
</dependency> |
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
package ch.lepeit.brain2; | |
import org.junit.Rule; | |
import static org.junit.Assert.*; | |
import org.junit.runner.RunWith; | |
import static com.eclipsesource.restfuse.Assert.*; | |
import com.eclipsesource.restfuse.Destination; | |
import com.eclipsesource.restfuse.HttpJUnitRunner; | |
import com.eclipsesource.restfuse.Method; | |
import com.eclipsesource.restfuse.Response; | |
import com.eclipsesource.restfuse.annotation.Context; | |
import com.eclipsesource.restfuse.annotation.HttpTest; | |
@RunWith(HttpJUnitRunner.class) | |
public class RestServerTest { | |
@Rule | |
public Destination destination = new Destination(this, "http://localhost:8080"); | |
@Context | |
private Response response; // will be injected after every request | |
@HttpTest(method = Method.GET, path = "/brain2/rest/brain2/stages") | |
public void checkRestfuseOnlineStatus() { | |
String erwAntwort = "[{\"name\":\"Development\",\"kurzName\":\"dev\",\"stage_ID\":1},{\"name\":\"Acceptance\",\"kurzName\":\"acc\",\"stage_ID\":2},{\"name\":\"Production\",\"kurzName\":\"prod\",\"stage_ID\":3}]"; | |
assertOk(response); | |
String body = response.getBody(); | |
assertEquals(erwAntwort, body); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gute Doku:
http://www.infoq.com/news/2011/11/restfuse-1-0-0