优化
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ class InboundPlanControllerTest {
|
||||
void platformPageAllowsAllCustomersWhenCustomerIdIsOmitted() {
|
||||
InboundPlanRequests.Query query = new InboundPlanRequests.Query(1, 20, null, null, null,
|
||||
null, null, null, null, null, null, null, null);
|
||||
when(service.page("100", query)).thenReturn(new PageResult<>(List.of(), 1, 20, 0, 0));
|
||||
when(service.page(null, query)).thenReturn(new PageResult<>(List.of(), 1, 20, 0, 0));
|
||||
|
||||
controller.page(platform(), null, query);
|
||||
|
||||
|
||||
+18
@@ -5,9 +5,13 @@ import com.baiyue.lastleg.masterdata.quote.entity.OverseasQuote;
|
||||
import com.baiyue.lastleg.masterdata.quote.mapper.OverseasQuoteMapper;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -36,4 +40,18 @@ class OverseasQuoteServiceTest {
|
||||
.isInstanceOf(ResponseStatusException.class)
|
||||
.hasMessageContaining("409 CONFLICT");
|
||||
}
|
||||
|
||||
@Test
|
||||
void overlapQueryUsesExecutableSqlOperators() throws NoSuchMethodException {
|
||||
Method method = OverseasQuoteMapper.class.getDeclaredMethod("countActiveOverlap",
|
||||
long.class, String.class, String.class, LocalDate.class, LocalDate.class, long.class);
|
||||
String sql = String.join(" ", method.getAnnotation(Select.class).value());
|
||||
|
||||
org.assertj.core.api.Assertions.assertThat(sql)
|
||||
.contains("id<>#{excludedId}")
|
||||
.contains("effective_start<=#{effectiveEnd}")
|
||||
.contains("effective_end>=#{effectiveStart}")
|
||||
.doesNotContain("<")
|
||||
.doesNotContain(">");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user