diff --git a/core/pom.xml b/core/pom.xml index fe65715f3..7d2032c7e 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -1,4 +1,4 @@ - + 4.0.0 - com.google.adk google-adk-parent - 0.4.1-SNAPSHOT + 0.4.1-SNAPSHOT + - google-adk Agent Development Kit Agent Development Kit: an open-source, code-first toolkit designed to simplify building, evaluating, and deploying advanced AI agents anywhere. - - - com.anthropic @@ -201,6 +197,15 @@ maven-compiler-plugin + + io.spring.javaformat + spring-javaformat-maven-plugin + 0.0.40 + + + + + - + \ No newline at end of file diff --git a/core/src/test/java/com/google/adk/models/AutoValueModelModelNameTest.java b/core/src/test/java/com/google/adk/models/AutoValueModelModelNameTest.java new file mode 100644 index 000000000..e256405b4 --- /dev/null +++ b/core/src/test/java/com/google/adk/models/AutoValueModelModelNameTest.java @@ -0,0 +1,102 @@ +// ********RoostGPT******** +/* +Test generated by RoostGPT for test unit-java-adk using AI Type Azure Open AI and AI Model gpt-5 + +ROOST_METHOD_HASH=modelName_dfe62c5922 +ROOST_METHOD_SIG_HASH=modelName_711aa70f4c + +Scenario 1: Returns a present Optional when modelName is set + +Details: + TestName: returnsPresentOptionalWhenModelNameIsSet + Description: Verifies that modelName() returns an Optional that is present when a non-null model name is provided through the Builder. Confirms that the contained value matches exactly what was set. + +Execution: + Arrange: Create an AutoValue_Model instance using its Builder and set modelName to a non-empty string such as "gpt-4". + Act: Invoke modelName() on the created instance. + Assert: Assert that the returned Optional is present and that the contained value equals "gpt-4". + +Validation: + The assertion verifies that modelName() correctly exposes the configured value and that the Optional indicates presence. This is significant because consumers rely on Optional presence to determine if a model name is available without performing null checks. + +*/ + +// ********RoostGPT******** +package com.google.adk.models; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.Optional; +import javax.annotation.processing.Generated; +import org.junit.jupiter.api.*; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +@Generated("AutoValueModelModelNameTest") +public abstract class AutoValueModelModelNameTest extends Model { + + @Test + @Tag("valid") + public void testReturnsPresentOptionalWhenModelNameIsSet() { + // Arrange + final String expectedModelName = (String) "gpt-4"; // TODO: change model name if + // needed + final Model model = + (Model) Model.builder().modelName((String) expectedModelName).model((BaseLlm) null).build(); + // Act + final Optional actual = (Optional) model.modelName(); + // Assert + assertNotNull((Optional) actual); + assertTrue(((Optional) actual).isPresent()); + assertEquals((String) expectedModelName, (String) actual.get()); + } + + @Test + @Tag("boundary") + public void testReturnsEmptyOptionalWhenModelNameIsNotSet() { + // Arrange + final Model model = + (Model) Model.builder().modelName((String) null).model((BaseLlm) null).build(); + // Act + final Optional actual = (Optional) model.modelName(); + // Assert + assertNotNull((Optional) actual); + assertFalse(((Optional) actual).isPresent()); + } + + @Test + @Tag("valid") + public void testToBuilderPreservesModelName() { + // Arrange + final String expectedModelName = (String) "gemini-1.5-pro"; // TODO: change model + // name if needed + final Model original = + (Model) Model.builder().modelName((String) expectedModelName).model((BaseLlm) null).build(); + // Act + final Model copy = (Model) original.toBuilder().build(); + final Optional actual = (Optional) copy.modelName(); + // Assert + assertNotNull((Optional) actual); + assertTrue(((Optional) actual).isPresent()); + assertEquals((String) expectedModelName, (String) actual.get()); + } + + @Test + @Tag("valid") + public void testModelNameUnchangedWhenModelIsSet() { + // Arrange + final String expectedModelName = (String) "test-model"; // TODO: change model name + // if needed + final BaseLlm mockLlm = (BaseLlm) Mockito.mock(BaseLlm.class); + final Model model = + (Model) + Model.builder().modelName((String) expectedModelName).model((BaseLlm) mockLlm).build(); + // Act + final Optional actual = (Optional) model.modelName(); + // Assert + assertNotNull((Optional) actual); + assertTrue(((Optional) actual).isPresent()); + assertEquals((String) expectedModelName, (String) actual.get()); + } +} diff --git a/pom.xml b/pom.xml index 6009c7316..24fd6ece6 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,4 @@ - + - + 4.0.0 - com.google.adk google-adk-parent - 0.4.1-SNAPSHOT + 0.4.1-SNAPSHOT + pom - Google Agent Development Kit Maven Parent POM https://github.com/google/adk-java Google Agent Development Kit (ADK) for Java - core dev @@ -39,12 +35,10 @@ a2a a2a/webservice - 17 ${java.version} UTF-8 - 1.11.0 3.4.1 1.49.0 @@ -73,7 +67,6 @@ 3.9.0 5.4.3 - @@ -112,7 +105,6 @@ pom import - com.anthropic @@ -274,9 +266,21 @@ assertj-core ${assertj.version} + + org.mockito + mockito-junit-jupiter + 2.23.4 + test + + + + io.spring.javaformat + spring-javaformat-formatter + 0.0.40 + + - @@ -324,8 +328,7 @@ plain - + **/*Test.java @@ -469,6 +472,36 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.5 + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 3.2.5 + + testReport + + + + + org.apache.maven.plugins + maven-site-plugin + 2.1 + + testReport + + + + + io.spring.javaformat + spring-javaformat-maven-plugin + 0.0.40 + + @@ -528,7 +561,6 @@ - The Apache License, Version 2.0 @@ -558,4 +590,19 @@ https://central.sonatype.com/repository/maven-snapshots/ + + + org.mockito + mockito-junit-jupiter + 2.23.4 + test + + + + io.spring.javaformat + spring-javaformat-formatter + 0.0.40 + + + \ No newline at end of file