fix: return A0404 for missing PDA pallets

This commit is contained in:
2026-09-04 14:07:18 +08:00
parent f6247ce232
commit 3399ae7488
13 changed files with 205 additions and 7 deletions
@@ -6,8 +6,10 @@ import org.springframework.http.MediaType;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestClient;
import org.springframework.web.server.ResponseStatusException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
@@ -57,4 +59,17 @@ class HttpWarehouseResourceGatewayTest {
server.verify();
}
@Test
void resolveMapsBusinessNotFoundEnvelopeToStableNotFound() {
server.expect(requestTo("http://warehouse/internal/v1/warehouse-pallets/resolve/MISSING"))
.andRespond(withSuccess("""
{"code":"A0404","message":"Not found","data":null}
""", MediaType.APPLICATION_JSON));
assertThatThrownBy(() -> gateway.resolvePallet("MISSING"))
.isInstanceOf(ResponseStatusException.class)
.hasMessageContaining("404");
server.verify();
}
}