|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2020 the original author or authors. |
| 2 | + * Copyright 2002-2021 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -105,7 +105,7 @@ public String getFilename() {
|
105 | 105 | FilePart mockPart = mock(FilePart.class);
|
106 | 106 | HttpHeaders partHeaders = new HttpHeaders();
|
107 | 107 | partHeaders.setContentType(MediaType.TEXT_PLAIN);
|
108 |
| - partHeaders.setContentDispositionFormData("filePublisher", "file.txt"); |
| 108 | + partHeaders.setContentDispositionFormData("foo", "file.txt"); |
109 | 109 | partHeaders.add("foo", "bar");
|
110 | 110 | given(mockPart.headers()).willReturn(partHeaders);
|
111 | 111 | given(mockPart.content()).willReturn(bufferPublisher);
|
@@ -159,17 +159,20 @@ public String getFilename() {
|
159 | 159 | assertThat(part.headers().getContentLength()).isEqualTo(utf8.getFile().length());
|
160 | 160 |
|
161 | 161 | part = requestParts.getFirst("json");
|
| 162 | + assertThat(part).isNotNull(); |
162 | 163 | assertThat(part.name()).isEqualTo("json");
|
163 | 164 | assertThat(part.headers().getContentType()).isEqualTo(MediaType.APPLICATION_JSON);
|
164 | 165 | String value = decodeToString(part);
|
165 | 166 | assertThat(value).isEqualTo("{\"bar\":\"bar\"}");
|
166 | 167 |
|
167 | 168 | part = requestParts.getFirst("publisher");
|
| 169 | + assertThat(part).isNotNull(); |
168 | 170 | assertThat(part.name()).isEqualTo("publisher");
|
169 | 171 | value = decodeToString(part);
|
170 | 172 | assertThat(value).isEqualTo("foobarbaz");
|
171 | 173 |
|
172 | 174 | part = requestParts.getFirst("filePublisher");
|
| 175 | + assertThat(part).isNotNull(); |
173 | 176 | assertThat(part.name()).isEqualTo("filePublisher");
|
174 | 177 | assertThat(part.headers()).containsEntry("foo", Collections.singletonList("bar"));
|
175 | 178 | assertThat(((FilePart) part).filename()).isEqualTo("file.txt");
|
|
0 commit comments