Homebox's location fields were flattened into single-purpose keys (locationName/locationDescription), which gave EmbeddingService no way to group related fields when rendering vector-store content. extraData is now Map<String, Map<String, Object>>, letting HomeboxItemClient express "location" as its own section; buildExtraData renders each section as a header with indented fields instead of a flat "Extradata: key: value" line.
37 lines
1.0 KiB
Java
37 lines
1.0 KiB
Java
package com.vaessl.app.search;
|
|
|
|
import static com.vaessl.app.Mockdata.*;
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
import java.util.Map;
|
|
import org.junit.jupiter.api.Test;
|
|
import com.vaessl.app.shared.ServiceItem;
|
|
|
|
class SearchResponseTest {
|
|
|
|
@Test
|
|
void shouldReturnNullWhenExtraDataIsNull() {
|
|
ServiceItem response = new ServiceItem(MOCK_ID, MOCK_TITLE, MOCK_DESCRIPTION, null);
|
|
|
|
assertThat(response.getExtra(null)).isNull();
|
|
}
|
|
|
|
@Test
|
|
void shouldReturnNullWhenExtraDataKeyIsMissing() {
|
|
|
|
ServiceItem response = new ServiceItem(MOCK_ID, MOCK_TITLE, MOCK_DESCRIPTION, Map.of("key", Map.of("key", "value")));
|
|
|
|
assertThat(response.getExtra("missing")).isNull();
|
|
}
|
|
|
|
@Test
|
|
void shouldReturnExtraDataValue() {
|
|
|
|
ServiceItem response = new ServiceItem(MOCK_ID, MOCK_TITLE, MOCK_DESCRIPTION, Map.of("key",
|
|
Map.of("key", "value")));
|
|
|
|
assertThat(response.id()).isEqualTo(MOCK_ID);
|
|
assertThat(response.getExtra("key")).contains("value");
|
|
|
|
}
|
|
}
|