1 // ***************************************************************************************************************************
2 // * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
3 // * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
4 // * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
5 // * with the License. You may obtain a copy of the License at *
6 // * *
7 // * http://www.apache.org/licenses/LICENSE-2.0 *
8 // * *
9 // * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
10 // * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
11 // * specific language governing permissions and limitations under the License. *
12 // ***************************************************************************************************************************
13 package org.apache.juneau.rest.springboot;
14
15 import static org.apache.juneau.commons.utils.Utils.*;
16 import static org.junit.jupiter.api.Assertions.*;
17
18 import org.apache.juneau.*;
19 import org.junit.jupiter.api.*;
20
21 /**
22 * Tests for SpringBeanStore fluent setter overrides.
23 */
24 class SpringBeanStore_Test extends TestBase {
25
26 @Test
27 void a01_fluentChaining_clear() {
28 // Test that clear() returns SpringBeanStore (not BeanStore)
29 var store = new SpringBeanStore(opte(), opte(), null);
30
31 SpringBeanStore result = store.clear();
32
33 assertSame(store, result);
34 assertInstanceOf(SpringBeanStore.class, result);
35 }
36
37 @Test
38 void a02_fluentChaining_removeBean_byClass() {
39 // Test that removeBean(Class) returns SpringBeanStore (not BeanStore)
40 var store = new SpringBeanStore(opte(), opte(), null);
41
42 SpringBeanStore result = store.removeBean(String.class);
43
44 assertSame(store, result);
45 assertInstanceOf(SpringBeanStore.class, result);
46 }
47
48 @Test
49 void a03_fluentChaining_removeBean_byClassAndName() {
50 // Test that removeBean(Class, String) returns SpringBeanStore (not BeanStore)
51 var store = new SpringBeanStore(opte(), opte(), null);
52
53 SpringBeanStore result = store.removeBean(String.class, "testBean");
54
55 assertSame(store, result);
56 assertInstanceOf(SpringBeanStore.class, result);
57 }
58
59 @Test
60 void a04_fluentChaining_complex() {
61 // Test chaining multiple fluent calls
62 var store = new SpringBeanStore(opte(), opte(), null);
63
64 SpringBeanStore result = store.removeBean(String.class).removeBean(Integer.class, "myInt").clear();
65
66 assertSame(store, result);
67 assertInstanceOf(SpringBeanStore.class, result);
68 }
69 }