=htj move directive tests into own package
This commit is contained in:
parent
79e24c5976
commit
30e4acacfa
3 changed files with 19 additions and 14 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
|
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.http.javadsl.server;
|
package akka.http.javadsl.server.directives;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import scala.Option;
|
import scala.Option;
|
||||||
|
|
@ -10,6 +10,7 @@ import scala.concurrent.Future;
|
||||||
import akka.http.javadsl.model.HttpRequest;
|
import akka.http.javadsl.model.HttpRequest;
|
||||||
import akka.http.javadsl.model.headers.Authorization;
|
import akka.http.javadsl.model.headers.Authorization;
|
||||||
import akka.http.javadsl.testkit.*;
|
import akka.http.javadsl.testkit.*;
|
||||||
|
import akka.http.javadsl.server.*;
|
||||||
import static akka.http.javadsl.server.Directives.*;
|
import static akka.http.javadsl.server.Directives.*;
|
||||||
|
|
||||||
public class AuthenticationDirectivesTest extends JUnitRouteTest {
|
public class AuthenticationDirectivesTest extends JUnitRouteTest {
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
|
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.http.javadsl.server;
|
package akka.http.javadsl.server.directives;
|
||||||
|
|
||||||
import static akka.http.javadsl.server.Directives.*;
|
import static akka.http.javadsl.server.Directives.*;
|
||||||
|
|
||||||
|
|
@ -11,6 +11,7 @@ import akka.http.javadsl.model.HttpRequest;
|
||||||
import akka.http.javadsl.model.headers.AcceptEncoding;
|
import akka.http.javadsl.model.headers.AcceptEncoding;
|
||||||
import akka.http.javadsl.model.headers.ContentEncoding;
|
import akka.http.javadsl.model.headers.ContentEncoding;
|
||||||
import akka.http.javadsl.model.headers.HttpEncodings;
|
import akka.http.javadsl.model.headers.HttpEncodings;
|
||||||
|
import akka.http.javadsl.server.Coder;
|
||||||
import akka.stream.ActorMaterializer;
|
import akka.stream.ActorMaterializer;
|
||||||
import akka.util.ByteString;
|
import akka.util.ByteString;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
@ -2,26 +2,29 @@
|
||||||
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
|
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.http.javadsl.server;
|
package akka.http.javadsl.server.directives;
|
||||||
|
|
||||||
import static akka.http.javadsl.server.Directives.*;
|
|
||||||
import akka.http.javadsl.testkit.*;
|
|
||||||
import akka.http.scaladsl.model.HttpRequest;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import akka.http.javadsl.server.*;
|
||||||
|
import akka.http.javadsl.testkit.*;
|
||||||
|
import akka.http.scaladsl.model.HttpRequest;
|
||||||
|
|
||||||
|
import static akka.http.javadsl.server.Directives.*;
|
||||||
|
|
||||||
public class PathDirectivesTest extends JUnitRouteTest {
|
public class PathDirectivesTest extends JUnitRouteTest {
|
||||||
@Test
|
@Test
|
||||||
public void testPathPrefixAndPath() {
|
public void testPathPrefixAndPath() {
|
||||||
TestRoute route =
|
TestRoute route =
|
||||||
testRoute(
|
testRoute(
|
||||||
pathPrefix("pet").route(
|
pathPrefix("pet").route(
|
||||||
path("cat").route(complete("The cat!")),
|
path("cat").route(complete("The cat!")),
|
||||||
path("dog").route(complete("The dog!")),
|
path("dog").route(complete("The dog!")),
|
||||||
pathSingleSlash().route(complete("Here are only pets."))
|
pathSingleSlash().route(complete("Here are only pets."))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
route.run(HttpRequest.GET("/pet/"))
|
route.run(HttpRequest.GET("/pet/"))
|
||||||
|
|
@ -41,9 +44,9 @@ public class PathDirectivesTest extends JUnitRouteTest {
|
||||||
public void testRawPathPrefix() {
|
public void testRawPathPrefix() {
|
||||||
TestRoute route1 =
|
TestRoute route1 =
|
||||||
testRoute(
|
testRoute(
|
||||||
rawPathPrefix(PathMatchers.SLASH(), "pet", PathMatchers.SLASH(), "", PathMatchers.SLASH(), "cat").route(
|
rawPathPrefix(PathMatchers.SLASH(), "pet", PathMatchers.SLASH(), "", PathMatchers.SLASH(), "cat").route(
|
||||||
complete("The cat!")
|
complete("The cat!")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
route1.run(HttpRequest.GET("/pet//cat"))
|
route1.run(HttpRequest.GET("/pet//cat"))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue