-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http-client-java_add-cadl-ranch-tests (#4368)
add cadl-ranch tests main focus is routes
- Loading branch information
1 parent
27c263e
commit 99abec9
Showing
9 changed files
with
133 additions
and
26 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
85 changes: 85 additions & 0 deletions
85
...client-java/generator/http-client-generator-test/src/test/java/com/routes/RouteTests.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,85 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.routes; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
|
||
public class RouteTests { | ||
|
||
@Test | ||
public void testFixed() { | ||
new RoutesClientBuilder().buildClient().fixed(); | ||
|
||
new RoutesClientBuilder().buildInInterfaceClient().fixed(); | ||
} | ||
|
||
@Test | ||
public void testPath() { | ||
var client = new RoutesClientBuilder().buildPathParametersClient(); | ||
|
||
client.templateOnly("a"); | ||
|
||
client.explicit("a"); | ||
|
||
client.annotationOnly("a"); | ||
} | ||
|
||
@Test | ||
public void testPathReservedExpansion() { | ||
var client = new RoutesClientBuilder().buildPathParametersReservedExpansionClient(); | ||
|
||
// TODO, need enhancement in core or codegen | ||
client.template("foo/bar baz".replace(" ", "%20")); | ||
client.annotation("foo/bar baz".replace(" ", "%20")); | ||
} | ||
|
||
@Test | ||
public void testQuery() { | ||
var client = new RoutesClientBuilder().buildQueryParametersClient(); | ||
|
||
client.templateOnly("a"); | ||
|
||
client.explicit("a"); | ||
|
||
client.annotationOnly("a"); | ||
} | ||
|
||
@Test | ||
public void testQueryExpansionStandard() { | ||
var client = new RoutesClientBuilder().buildQueryParametersQueryExpansionStandardClient(); | ||
|
||
client.primitive("a"); | ||
|
||
client.array(List.of("a", "b")); | ||
} | ||
|
||
@Test | ||
public void testQueryExpansionContinuationStandard() { | ||
var client = new RoutesClientBuilder().buildQueryParametersQueryContinuationStandardClient(); | ||
|
||
client.primitive("a"); | ||
|
||
client.array(List.of("a", "b")); | ||
} | ||
|
||
@Test | ||
public void testQueryExpansionExplode() { | ||
var client = new RoutesClientBuilder().buildQueryParametersQueryExpansionExplodeClient(); | ||
|
||
client.primitive("a"); | ||
|
||
// client.array(List.of("a", "b")); | ||
} | ||
|
||
@Test | ||
public void buildQueryParametersQueryContinuationExplode() { | ||
var client = new RoutesClientBuilder().buildQueryParametersQueryContinuationExplodeClient(); | ||
|
||
client.primitive("a"); | ||
|
||
// client.array(List.of("a", "b")); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...-generator-test/src/test/java/com/specialheaders/conditionalrequest/ConditionalTests.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 |
---|---|---|
@@ -1,15 +1,24 @@ | ||
package com.specialheaders.conditionalrequest; | ||
|
||
import com.azure.core.util.DateTimeRfc1123; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.OffsetDateTime; | ||
|
||
public class ConditionalTests { | ||
|
||
private final ConditionalRequestClient client = new ConditionalRequestClientBuilder().buildClient(); | ||
|
||
private static final OffsetDateTime DATE_TIME = new DateTimeRfc1123("Fri, 26 Aug 2022 14:38:00 GMT").getDateTime(); | ||
|
||
@Test | ||
public void testConditional() { | ||
client.postIfMatch("\"valid\""); | ||
|
||
client.postIfNoneMatch("\"invalid\""); | ||
|
||
client.headIfModifiedSince(DATE_TIME); | ||
|
||
client.postIfUnmodifiedSince(DATE_TIME); | ||
} | ||
} |