feat(services-counter): lead search, detail and update
Search lists every lead in the company with its event count, last event and latest salesperson, worked out at read time. Detail adds the event history and other leads sharing the mobile or email. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
a1d9a82d88
commit
e75ef80dc0
13 files changed
+462
-1
No files matched your search
+49
@@ -0,0 +1,49 @@
|
||||
package com.solvway.services.counter.controller;
|
||||
|
||||
import com.solvway.services.counter.dto.LeadDetail;
|
||||
import com.solvway.services.counter.dto.LeadSearchRequest;
|
||||
import com.solvway.services.counter.dto.LeadSummary;
|
||||
import com.solvway.services.counter.dto.LeadUpdateRequest;
|
||||
import com.solvway.services.counter.service.LeadService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/** LeadController delegates to the service and returns its result. */
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class LeadControllerTest {
|
||||
|
||||
@Mock private LeadService service;
|
||||
|
||||
@Test
|
||||
void searchDelegates() {
|
||||
LeadSearchRequest req = new LeadSearchRequest(42L, "a", null, 0, 20);
|
||||
Page<LeadSummary> out = Page.empty();
|
||||
when(service.search(req)).thenReturn(out);
|
||||
|
||||
assertThat(new LeadController(service).search(req)).isSameAs(out);
|
||||
}
|
||||
|
||||
@Test
|
||||
void detailDelegates() {
|
||||
LeadDetail out = mock(LeadDetail.class);
|
||||
when(service.detail(42L, 7L)).thenReturn(out);
|
||||
|
||||
assertThat(new LeadController(service).detail(42L, 7L)).isSameAs(out);
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateDelegates() {
|
||||
LeadUpdateRequest req = mock(LeadUpdateRequest.class);
|
||||
LeadDetail out = mock(LeadDetail.class);
|
||||
when(service.update(req)).thenReturn(out);
|
||||
|
||||
assertThat(new LeadController(service).update(req)).isSameAs(out);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user