Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .chronus/changes/add-test-withRelativeNextLink-2026-4-14.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: feature
packages:
- "@typespec/http-client-java"
---

Add test case for `withRelativeNextLink`, `FlattenUnknownModel`, `FlattenReadOnlyModel` scenario.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
import azure.clientgenerator.core.flattenproperty.models.ChildFlattenModel;
import azure.clientgenerator.core.flattenproperty.models.ChildModel;
import azure.clientgenerator.core.flattenproperty.models.FlattenModel;
import azure.clientgenerator.core.flattenproperty.models.FlattenUnknownModel;
import azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel;
import azure.clientgenerator.core.flattenproperty.models.Solution;
import azure.clientgenerator.core.flattenproperty.models.SolutionProperties;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class FlattenClientTests {
Expand All @@ -19,4 +23,24 @@ public void testFlattenModel() {
flattenClient.putNestedFlattenModel(
new NestedFlattenModel("foo", new ChildFlattenModel("bar", new ChildModel("test", 10))));
}

@Test
public void testPutFlattenUnknownModel() {
// flatten is ignored for unknown (non-model) type properties
FlattenUnknownModel result = flattenClient.putFlattenUnknownModel(new FlattenUnknownModel("foo"));
Assertions.assertEquals("test", result.getName());
Assertions.assertNotNull(result.getProperties());
}

@Test
public void testPutFlattenReadOnlyModel() {
// flatten with all read-only properties; input only contains writable fields
Solution result = flattenClient.putFlattenReadOnlyModel(new Solution("foo"));
Assertions.assertEquals("foo", result.getName());
SolutionProperties properties = result.getProperties();
Assertions.assertNotNull(properties);
Assertions.assertEquals("solution1", properties.getSolutionId());
Assertions.assertEquals("Solution Title", properties.getTitle());
Assertions.assertEquals("Solution Content", properties.getContent());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ public void testPageRequestBody() {
public void testPageNextLinkReInjectedParameters() {
Assertions.assertEquals(2, client.withParameterizedNextLink("name", true).stream().count());
}

@Test
public void testPageWithRelativeNextLink() {
Assertions.assertEquals(2, client.withRelativeNextLink().stream().count());
}
}
Loading