|
31 | 31 | import com.google.genai.types.Content; |
32 | 32 | import java.util.HashMap; |
33 | 33 | import java.util.Map; |
34 | | -import java.util.Optional; |
35 | 34 | import java.util.concurrent.ConcurrentHashMap; |
36 | 35 | import org.junit.Assert; |
37 | 36 | import org.junit.Before; |
@@ -607,45 +606,6 @@ public void testBranch() { |
607 | 606 | assertThat(context.branch()).isEmpty(); |
608 | 607 | } |
609 | 608 |
|
610 | | - @Test |
611 | | - // Testing deprecated methods. |
612 | | - public void testDeprecatedCreateMethods() { |
613 | | - InvocationContext context1 = |
614 | | - InvocationContext.builder() |
615 | | - .sessionService(mockSessionService) |
616 | | - .artifactService(mockArtifactService) |
617 | | - .invocationId(testInvocationId) |
618 | | - .agent(mockAgent) |
619 | | - .session(session) |
620 | | - .userContent(Optional.ofNullable(userContent)) |
621 | | - .runConfig(runConfig) |
622 | | - .build(); |
623 | | - |
624 | | - assertThat(context1.sessionService()).isEqualTo(mockSessionService); |
625 | | - assertThat(context1.artifactService()).isEqualTo(mockArtifactService); |
626 | | - assertThat(context1.invocationId()).isEqualTo(testInvocationId); |
627 | | - assertThat(context1.agent()).isEqualTo(mockAgent); |
628 | | - assertThat(context1.session()).isEqualTo(session); |
629 | | - assertThat(context1.userContent()).hasValue(userContent); |
630 | | - assertThat(context1.runConfig()).isEqualTo(runConfig); |
631 | | - |
632 | | - InvocationContext context2 = |
633 | | - InvocationContext.create( |
634 | | - mockSessionService, |
635 | | - mockArtifactService, |
636 | | - mockAgent, |
637 | | - session, |
638 | | - liveRequestQueue, |
639 | | - runConfig); |
640 | | - |
641 | | - assertThat(context2.sessionService()).isEqualTo(mockSessionService); |
642 | | - assertThat(context2.artifactService()).isEqualTo(mockArtifactService); |
643 | | - assertThat(context2.agent()).isEqualTo(mockAgent); |
644 | | - assertThat(context2.session()).isEqualTo(session); |
645 | | - assertThat(context2.liveRequestQueue()).hasValue(liveRequestQueue); |
646 | | - assertThat(context2.runConfig()).isEqualTo(runConfig); |
647 | | - } |
648 | | - |
649 | 609 | @Test |
650 | 610 | public void testActiveStreamingTools() { |
651 | 611 | InvocationContext context = |
@@ -686,78 +646,16 @@ public void testBuilderOptionalParameters() { |
686 | 646 | .artifactService(mockArtifactService) |
687 | 647 | .agent(mockAgent) |
688 | 648 | .session(session) |
689 | | - .liveRequestQueue(Optional.of(liveRequestQueue)) |
690 | | - .branch(Optional.of("test-branch")) |
691 | | - .userContent(Optional.of(userContent)) |
| 649 | + .liveRequestQueue(liveRequestQueue) |
| 650 | + .branch("test-branch") |
| 651 | + .userContent(userContent) |
692 | 652 | .build(); |
693 | 653 |
|
694 | 654 | assertThat(context.liveRequestQueue()).hasValue(liveRequestQueue); |
695 | 655 | assertThat(context.branch()).hasValue("test-branch"); |
696 | 656 | assertThat(context.userContent()).hasValue(userContent); |
697 | 657 | } |
698 | 658 |
|
699 | | - @Test |
700 | | - // Testing deprecated methods. |
701 | | - public void testDeprecatedConstructor() { |
702 | | - InvocationContext context = |
703 | | - new InvocationContext( |
704 | | - mockSessionService, |
705 | | - mockArtifactService, |
706 | | - mockMemoryService, |
707 | | - pluginManager, |
708 | | - Optional.of(liveRequestQueue), |
709 | | - Optional.of("test-branch"), |
710 | | - testInvocationId, |
711 | | - mockAgent, |
712 | | - session, |
713 | | - Optional.of(userContent), |
714 | | - runConfig, |
715 | | - true); |
716 | | - |
717 | | - assertThat(context.sessionService()).isEqualTo(mockSessionService); |
718 | | - assertThat(context.artifactService()).isEqualTo(mockArtifactService); |
719 | | - assertThat(context.memoryService()).isEqualTo(mockMemoryService); |
720 | | - assertThat(context.pluginManager()).isEqualTo(pluginManager); |
721 | | - assertThat(context.liveRequestQueue()).hasValue(liveRequestQueue); |
722 | | - assertThat(context.branch()).hasValue("test-branch"); |
723 | | - assertThat(context.invocationId()).isEqualTo(testInvocationId); |
724 | | - assertThat(context.agent()).isEqualTo(mockAgent); |
725 | | - assertThat(context.session()).isEqualTo(session); |
726 | | - assertThat(context.userContent()).hasValue(userContent); |
727 | | - assertThat(context.runConfig()).isEqualTo(runConfig); |
728 | | - assertThat(context.endInvocation()).isTrue(); |
729 | | - } |
730 | | - |
731 | | - @Test |
732 | | - // Testing deprecated methods. |
733 | | - public void testDeprecatedConstructor_11params() { |
734 | | - InvocationContext context = |
735 | | - new InvocationContext( |
736 | | - mockSessionService, |
737 | | - mockArtifactService, |
738 | | - mockMemoryService, |
739 | | - Optional.of(liveRequestQueue), |
740 | | - Optional.of("test-branch"), |
741 | | - testInvocationId, |
742 | | - mockAgent, |
743 | | - session, |
744 | | - Optional.of(userContent), |
745 | | - runConfig, |
746 | | - true); |
747 | | - |
748 | | - assertThat(context.sessionService()).isEqualTo(mockSessionService); |
749 | | - assertThat(context.artifactService()).isEqualTo(mockArtifactService); |
750 | | - assertThat(context.memoryService()).isEqualTo(mockMemoryService); |
751 | | - assertThat(context.liveRequestQueue()).hasValue(liveRequestQueue); |
752 | | - assertThat(context.branch()).hasValue("test-branch"); |
753 | | - assertThat(context.invocationId()).isEqualTo(testInvocationId); |
754 | | - assertThat(context.agent()).isEqualTo(mockAgent); |
755 | | - assertThat(context.session()).isEqualTo(session); |
756 | | - assertThat(context.userContent()).hasValue(userContent); |
757 | | - assertThat(context.runConfig()).isEqualTo(runConfig); |
758 | | - assertThat(context.endInvocation()).isTrue(); |
759 | | - } |
760 | | - |
761 | 659 | @Test |
762 | 660 | public void build_missingInvocationId_null_throwsException() { |
763 | 661 | InvocationContext.Builder builder = |
|
0 commit comments