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/InMemoryMemoryServiceAddSessionToMemoryTest.java b/core/src/test/java/com/google/adk/memory/InMemoryMemoryServiceAddSessionToMemoryTest.java
new file mode 100644
index 000000000..3573e005f
--- /dev/null
+++ b/core/src/test/java/com/google/adk/memory/InMemoryMemoryServiceAddSessionToMemoryTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// ********RoostGPT********
+/*
+Test generated by RoostGPT for test unit-java-adk using AI Type Azure Open AI and AI Model gpt-5
+
+ROOST_METHOD_HASH=addSessionToMemory_8a630adf5c
+ROOST_METHOD_SIG_HASH=addSessionToMemory_3e3003d0a0
+
+Scenario 1: Successfully stores a session with events that have non-empty parts
+
+Details:
+ TestName: storesSessionWithEventsHavingNonEmptyParts
+ Description: Verifies that addSessionToMemory stores a session whose events include content with present, non-empty parts. Confirms that the returned Completable completes without errors and that the stored events are discoverable via searchMemory.
+
+Execution:
+ Arrange: Create a Session with appName "appA", userId "user1", session id "s1", and events where at least one event has content().isPresent() and parts().isPresent() with a non-empty list containing a Part with non-empty text like "hello world".
+ Act: Invoke addSessionToMemory(session) and await the Completable to complete. Then call searchMemory("appA", "user1", "hello") to retrieve memories.
+ Assert: Assert the Completable completes successfully. Assert that searchMemory returns at least one MemoryEntry with content containing the word "hello".
+
+Validation:
+ Confirms that events meeting the filter (content present, parts present and non-empty) are retained and can be retrieved through searchMemory. Ensures the Completable signals completion, indicating the write to memory occurred.
+
+*/
+
+// ********RoostGPT********
+
+package com.google.adk.memory;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import com.google.adk.events.Event;
+import com.google.adk.sessions.Session;
+import com.google.genai.types.Content;
+import com.google.genai.types.Part;
+import io.reactivex.rxjava3.observers.TestObserver;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.Optional;
+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.junit.jupiter.MockitoExtension;
+
+@ExtendWith(MockitoExtension.class)
+class InMemoryMemoryServiceAddSessionToMemoryTest {
+
+ @Test
+ @Tag("integration")
+ public void testStoresSessionWithEventsHavingNonEmptyParts() {
+ // Arrange
+ InMemoryMemoryService service = new InMemoryMemoryService();
+ Part part = mock(Part.class);
+ when(part.text()).thenReturn(Optional.of("hello world"));
+ Content content = mock(Content.class);
+ when(content.parts()).thenReturn(Optional.of(Collections.singletonList(part)));
+ Event event = mock(Event.class);
+ when(event.content()).thenReturn(Optional.of(content));
+ when(event.author()).thenReturn("user");
+ when(event.timestamp()).thenReturn(1700000000L);
+ Session session = mock(Session.class);
+ when(session.appName()).thenReturn("appA");
+ when(session.userId()).thenReturn("user1");
+ when(session.id()).thenReturn("s1");
+ when(session.events()).thenReturn((List) Collections.singletonList(event));
+ // Act
+ TestObserver addObserver = service.addSessionToMemory(session).test();
+ // Assert - Completable completion
+ addObserver.assertComplete();
+ addObserver.assertNoErrors();
+ // Act - search memory
+ Object response = service.searchMemory("appA", "user1", "hello").blockingGet();
+ // Assert - search result is not null and contains expected word
+ assertNotNull((Object) response);
+ String responseString = response.toString().toLowerCase(Locale.ROOT);
+ assertTrue((boolean) responseString.contains("hello"));
+ }
+}
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