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/memory/AutoValueMemoryEntryContentTest.java b/core/src/test/java/com/google/adk/memory/AutoValueMemoryEntryContentTest.java
new file mode 100644
index 000000000..b37ab697f
--- /dev/null
+++ b/core/src/test/java/com/google/adk/memory/AutoValueMemoryEntryContentTest.java
@@ -0,0 +1,115 @@
+// ********RoostGPT********
+/*
+Test generated by RoostGPT for test unit-java-adk using AI Type Azure Open AI and AI Model gpt-5
+
+ROOST_METHOD_HASH=content_f95ec3ddc9
+ROOST_METHOD_SIG_HASH=content_accc65ce1a
+
+
+Scenario 1: Returns the same Content instance that was supplied at construction
+
+Details:
+ TestName: returnsSameContentInstance
+ Description: Verify that the content() method returns the exact Content object that was used to build the AutoValue_MemoryEntry instance (reference identity, not a copy).
+
+Execution:
+ Arrange: Create a valid Content instance (e.g., a concrete instance or a simple test double) and build a MemoryEntry via the Builder with that Content.
+ Act: Call content() on the built MemoryEntry.
+ Assert: Use JUnit assertions to confirm that the returned Content is the same object instance as the one provided during construction (reference equality).
+
+Validation:
+ This assertion verifies that content() is a simple accessor returning the internal field without copying or transforming it. It ensures the method exposes the exact Content reference stored in the entry, which is important for consumers relying on object identity or avoiding unnecessary allocations.
+
+*/
+
+// ********RoostGPT********
+package com.google.adk.memory;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import com.google.genai.types.Content;
+import org.junit.jupiter.api.*;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mockito;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+// NOSONAR: Included as per instructions
+// NOSONAR: Included as per instructions
+// NOSONAR: Included as per instructions
+@ExtendWith(MockitoExtension.class)
+public class AutoValueMemoryEntryContentTest {
+
+ @Test
+ @Tag("valid")
+ @DisplayName("content() returns the same Content instance supplied at construction")
+ public void testReturnsSameContentInstance() {
+ final Content given = Mockito.mock(Content.class);
+ final String author = "test-author"; // TODO: adjust if needed
+ final String timestamp = "2024-01-01T00:00:00Z"; // TODO: adjust if needed
+ final MemoryEntry entry =
+ MemoryEntry.builder().content(given).author(author).timestamp(timestamp).build();
+ final Content actual = entry.content();
+ assertSame(
+ (Content) given,
+ (Content) actual,
+ "content() should return the same instance that was provided");
+ }
+
+ @Test
+ @Tag("valid")
+ @DisplayName("content() is not null when provided and optional fields are omitted")
+ public void testContentNotNullWhenProvidedWithNullOptionals() {
+ final Content given = Mockito.mock(Content.class);
+ final MemoryEntry entry = MemoryEntry.builder().content(given).build();
+ assertNotNull(
+ (Object) entry.content(), "content() should not be null when supplied via builder");
+ }
+
+ @Test
+ @Tag("integration")
+ @DisplayName("toBuilder().build() preserves content reference identity")
+ public void testToBuilderPreservesContentIdentity() {
+ final Content given = Mockito.mock(Content.class);
+ final MemoryEntry entry =
+ MemoryEntry.builder()
+ .content(given)
+ .author((String) null) // Disambiguate potential overloaded methods
+ .timestamp((String) null) // Disambiguate potential overloaded methods
+ .build();
+ final MemoryEntry copy = entry.toBuilder().build();
+ assertSame(
+ (Content) entry.content(),
+ (Content) copy.content(),
+ "toBuilder().build() should preserve content identity");
+ }
+
+ @Test
+ @Tag("boundary")
+ @DisplayName(
+ "Distinct entries with different Content instances yield different content references")
+ public void testDifferentEntriesHaveDifferentContentReferences() {
+ final Content content1 = Mockito.mock(Content.class);
+ final Content content2 = Mockito.mock(Content.class);
+ final MemoryEntry entry1 = MemoryEntry.builder().content(content1).build();
+ final MemoryEntry entry2 = MemoryEntry.builder().content(content2).build();
+ assertNotSame(
+ (Content) entry1.content(),
+ (Content) entry2.content(),
+ "Different entries built with different Content instances should not share references");
+ }
+
+ @Test
+ @Tag("invalid")
+ @DisplayName("Builder with null content throws NullPointerException")
+ public void testBuilderWithNullContentThrows() {
+ assertThrows(
+ NullPointerException.class,
+ () -> {
+ MemoryEntry.builder().content((Content) null).build();
+ },
+ "Building MemoryEntry with null content should throw NullPointerException");
+ }
+}
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