Skip to content

Commit 33594d2

Browse files
committed
fix(tests): Update api_dev test to use LegacyMailServiceImpl
Updated the mail service test in the module to reflect the recent refactoring. This test was failing in the CI environment because it was still referencing the old class. - Renamed to . - Updated the test class to instantiate and test . This change resolves the build failures observed in the GitHub workflow.
1 parent 3e06a59 commit 33594d2

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

api_dev/src/test/java/com/google/appengine/api/mail/MailServiceImplTest.java renamed to api_dev/src/test/java/com/google/appengine/api/mail/LegacyMailServiceImplTest.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
import org.mockito.junit.MockitoRule;
4343

4444
/**
45-
* Unit tests for the MailServiceImpl class. Cloned from URLFetchService.
45+
* Unit tests for the LegacyMailServiceImpl class. Cloned from URLFetchService.
4646
*
4747
*/
4848
@RunWith(JUnit4.class)
49-
public class MailServiceImplTest {
49+
public class LegacyMailServiceImplTest {
5050
@Rule public MockitoRule mockitoRule = MockitoJUnit.rule();
5151

5252
@Mock private ApiProxy.Delegate<ApiProxy.Environment> delegate;
@@ -57,7 +57,7 @@ public class MailServiceImplTest {
5757
public void setUp() throws Exception {
5858
ApiProxy.setDelegate(delegate);
5959
ApiProxy.setEnvironmentForCurrentThread(environment);
60-
service = new MailServiceImpl();
60+
service = new LegacyMailServiceImpl();
6161
}
6262

6363
@After
@@ -119,10 +119,10 @@ public void testSendAllNull() throws Exception {
119119

120120
when(delegate.makeSyncCall(any(), any(), any(), any())).thenReturn(new byte[0]);
121121

122-
new MailServiceImpl().send(msg);
122+
new LegacyMailServiceImpl().send(msg);
123123
verify(delegate)
124124
.makeSyncCall(
125-
same(environment), eq(MailServiceImpl.PACKAGE), eq("Send"), eq(msgProto.toByteArray()));
125+
same(environment), eq(LegacyMailServiceImpl.PACKAGE), eq("Send"), eq(msgProto.toByteArray()));
126126
}
127127

128128
/** Tests that a message with an attachment works correctly. */
@@ -145,7 +145,7 @@ public void testDoSend_withAttachment() throws Exception {
145145
verify(delegate)
146146
.makeSyncCall(
147147
same(environment),
148-
eq(MailServiceImpl.PACKAGE),
148+
eq(LegacyMailServiceImpl.PACKAGE),
149149
eq("Send"),
150150
eq(msgProto.build().toByteArray()));
151151
}
@@ -175,7 +175,7 @@ public void testDoSend_withContentIDAttachment() throws Exception {
175175

176176
verify(delegate)
177177
.makeSyncCall(
178-
same(environment), eq(MailServiceImpl.PACKAGE), eq("Send"), eq(msgProto.toByteArray()));
178+
same(environment), eq(LegacyMailServiceImpl.PACKAGE), eq("Send"), eq(msgProto.toByteArray()));
179179
}
180180

181181
/** Tests that sending a AMP Email message works correctly. */
@@ -199,7 +199,7 @@ public void testDoSend_ampEmail() throws Exception {
199199
service.send(msg);
200200
verify(delegate)
201201
.makeSyncCall(
202-
same(environment), eq(MailServiceImpl.PACKAGE), eq("Send"), eq(msgProto.toByteArray()));
202+
same(environment), eq(LegacyMailServiceImpl.PACKAGE), eq("Send"), eq(msgProto.toByteArray()));
203203
}
204204

205205
/** Tests that a message with a header works correctly. */
@@ -220,7 +220,7 @@ public void testDoSend_withHeader() throws Exception {
220220
verify(delegate)
221221
.makeSyncCall(
222222
same(environment),
223-
eq(MailServiceImpl.PACKAGE),
223+
eq(LegacyMailServiceImpl.PACKAGE),
224224
eq("Send"),
225225
eq(msgProto.build().toByteArray()));
226226
}
@@ -237,7 +237,7 @@ public void testDoSend_replyToAddress() throws Exception {
237237

238238
verify(delegate)
239239
.makeSyncCall(
240-
same(environment), eq(MailServiceImpl.PACKAGE), eq("Send"), eq(msgProto.toByteArray()));
240+
same(environment), eq(LegacyMailServiceImpl.PACKAGE), eq("Send"), eq(msgProto.toByteArray()));
241241
}
242242

243243
@Test
@@ -306,7 +306,7 @@ private void runRecipientTest(String to, String cc, String bcc) throws Exception
306306
verify(delegate)
307307
.makeSyncCall(
308308
same(environment),
309-
eq(MailServiceImpl.PACKAGE),
309+
eq(LegacyMailServiceImpl.PACKAGE),
310310
eq("Send"),
311311
eq(msgProto.build().toByteArray()));
312312
}
@@ -324,7 +324,7 @@ private MailService.Message setupSendCallWithApplicationException(ErrorCode code
324324
MailMessage msgProto = newMailMessage(msg);
325325

326326
when(delegate.makeSyncCall(
327-
same(environment), eq(MailServiceImpl.PACKAGE), eq("Send"), eq(msgProto.toByteArray())))
327+
same(environment), eq(LegacyMailServiceImpl.PACKAGE), eq("Send"), eq(msgProto.toByteArray())))
328328
.thenThrow(new ApiProxy.ApplicationException(code.getNumber(), "detail"));
329329

330330
return msg;
@@ -365,7 +365,7 @@ public void testSendToAdmins() throws Exception {
365365
verify(delegate)
366366
.makeSyncCall(
367367
same(environment),
368-
eq(MailServiceImpl.PACKAGE),
368+
eq(LegacyMailServiceImpl.PACKAGE),
369369
eq("SendToAdmins"),
370370
eq(msgProto.toByteArray()));
371371
}
@@ -383,8 +383,8 @@ public void testSendToAdmins_multiArgConstructor() throws Exception {
383383
verify(delegate)
384384
.makeSyncCall(
385385
same(environment),
386-
eq(MailServiceImpl.PACKAGE),
386+
eq(LegacyMailServiceImpl.PACKAGE),
387387
eq("SendToAdmins"),
388388
eq(msgProto.toByteArray()));
389389
}
390-
}
390+
}

0 commit comments

Comments
 (0)