我正在尝试使用 LocalStack 进行端到端测试,但无法阅读通过 LocalStack/SES 发送的电子邮件。有没有办法做到这一点?
我希望我的 Cypress e2e 测试调用我的后端服务,后端服务撰写一封包含链接的电子邮件并通过 LocalStack/SES 发送电子邮件。然后我希望我的 e2e 测试等待该电子邮件,阅读其中发送的链接,然后继续。
我设法调用 LocalStack 的 SES 来发送电子邮件,并且我知道支持 LocalStack 的 moto 库将发送的消息存储在内存中。有没有办法阅读这些消息?
我试图在我的一个Spring Boot项目中使用Spring LDAP,但是运行多个测试时出现“ Address in use”错误。
我已经在这里本地克隆了示例项目:https : //spring.io/guides/gs/authenticating-ldap/
...并刚刚添加了通常由Spring Boot创建的样板测试,以验证Application Context是否正确加载:
@RunWith(SpringRunner.class)
@SpringBootTest
public class MyApplicationTests {
@Test
public void contextLoads() {
}
}
Run Code Online (Sandbox Code Playgroud)
如果单独运行,则此测试通过。一旦LdapAuthenticationTests和MyApplicationTests一起运行,我会得到上面关于后者的错误。
经过一番调试后,我发现发生这种情况是因为系统尝试生成嵌入式服务器的第二个实例。
我确定我在配置中缺少一些非常愚蠢的东西。我该如何解决这个问题?
鉴于以下情况:
"John Smith"
"John Smith (123)"
"John Smith (123) (456)"
Run Code Online (Sandbox Code Playgroud)
我想捕捉:
"John Smith"
"John Smith", "123"
"John Smith (123)", "456"
Run Code Online (Sandbox Code Playgroud)
什么 Java 正则表达式允许我这样做?
我试过(.+)\s\((\d+)\)$,它适用于“约翰史密斯 (123)”和“约翰史密斯 (123) (456)”,但不适用于“约翰史密斯”。如何更改正则表达式以适用于第一个输入?
amazon-ses ×1
cypress ×1
java ×1
localstack ×1
regex ×1
spring-boot ×1
spring-ldap ×1
testing ×1