Skip to content
Open
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
21 changes: 13 additions & 8 deletions core/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0"?>
<!--
Copyright 2025 Google LLC

Expand All @@ -16,19 +16,15 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.google.adk</groupId>
<artifactId>google-adk-parent</artifactId>
<version>0.4.1-SNAPSHOT</version><!-- {x-version-update:google-adk:current} -->
<version>0.4.1-SNAPSHOT</version>
<!-- {x-version-update:google-adk:current} -->
</parent>

<artifactId>google-adk</artifactId>
<name>Agent Development Kit</name>
<description>Agent Development Kit: an open-source, code-first toolkit designed to simplify building, evaluating, and deploying advanced AI agents anywhere.</description>



<dependencies>
<dependency>
<groupId>com.anthropic</groupId>
Expand Down Expand Up @@ -201,6 +197,15 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-maven-plugin</artifactId>
<version>0.0.40</version>
<!--Plugin added by RoostGPT-->
</plugin>
</plugins>
<pluginManagement>
<plugins/>
</pluginManagement>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// ********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.fasterxml.jackson.annotation.JsonProperty;
import com.google.genai.types.Content;
import javax.annotation.Nullable;
import javax.annotation.processing.Generated;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

@Generated("com.google.auto.value.processor.AutoValueProcessor")
@ExtendWith(MockitoExtension.class)
public class AutoValueMemoryEntryContentTest {

@Mock private Content contentA;

@Mock private Content contentB;

private static final class DummyAnnotated {

@JsonProperty("content")
@Nullable
String v;
}

@Test
@Tag("valid")
public void testReturnsSameContentInstance() {
MemoryEntry.Builder builder = MemoryEntry.builder();
MemoryEntry entry =
builder
.content(contentA)
.author("Alice") // TODO: Change test author if necessary
.timestamp("2023-01-01T00:00:00Z") // TODO: Provide a valid ISO 8601 timestamp
// if necessary
.build();
Content actual = entry.content();
assertSame((Content) contentA, (Content) actual);
}

@Test
@Tag("invalid")
public void testMissingContentThrowsException() {
MemoryEntry.Builder builder =
MemoryEntry.builder().author("Bob").timestamp("2023-01-01T00:00:00Z");
assertThrows(IllegalStateException.class, builder::build);
}

@Test
@Tag("boundary")
public void testAllowsNullAuthorAndTimestamp() {
MemoryEntry.Builder builder = MemoryEntry.builder();
MemoryEntry entry =
builder
.content(contentA)
.author((String) null) // Disambiguate potential overloaded method call with
// null
.timestamp((String) null) // Disambiguate potential overloaded method call
// with null
.build();
assertSame((Content) contentA, (Content) entry.content());
assertNull((String) entry.author());
assertNull((String) entry.timestamp());
}

@Test
@Tag("integration")
public void testToBuilderRetainsSameContentInstance() {
MemoryEntry entry =
MemoryEntry.builder()
.content(contentA)
.author("Carol")
.timestamp("2023-01-01T00:00:00Z")
.build();
MemoryEntry.Builder copyBuilder = entry.toBuilder();
MemoryEntry copied = copyBuilder.build();
assertSame((Content) entry.content(), (Content) copied.content());
assertEquals((String) entry.author(), (String) copied.author());
assertEquals((String) entry.timestamp(), (String) copied.timestamp());
}

@Test
@Tag("valid")
public void testDifferentContentInstancesRemainDistinct() {
MemoryEntry first =
MemoryEntry.builder()
.content(contentA)
.author("Dave")
.timestamp("2023-01-01T00:00:00Z")
.build();
MemoryEntry second =
MemoryEntry.builder()
.content(contentB)
.author("Eve")
.timestamp("2023-01-02T00:00:00Z")
.build();
assertNotSame((Content) first.content(), (Content) second.content());
}
}
Loading