小编Pro*_*att的帖子

Spring的@Retryable在运行JUnit Test时无法正常工作

我有这个测试:

@RunWith(MockitoJUnitRunner.class)
public class myServiceTest {

@InjectMocks
myService subject;

private myService spy;

@Before
public void before() {
    spy = spy(subject);
}

@Test
public void testing() {

    when(spy.print2()).thenThrow(new RuntimeException()).thenThrow(new RuntimeException()).thenReturn("completed");
    spy.print1();
    verify(spy, times(3)).print2();
}
Run Code Online (Sandbox Code Playgroud)

然后我有:

@Service("myService")
public class myService extends myAbstractServiceClass {


public String print1() {
    String temp = "";
    temp = print2();
    return temp;
}

 @Retryable
 public String print2() {
     return "completed";
 }
}
Run Code Online (Sandbox Code Playgroud)

然后我有这个接口(我的abstractService实现):

public interface myServiceInterface {

    @Retryable(maxAttempts = 3)
    String print1() throws RuntimeException;

    @Retryable(maxAttempts = 3)
    String …
Run Code Online (Sandbox Code Playgroud)

java junit spring maven spring-retry

6
推荐指数
2
解决办法
7285
查看次数

如何从docker容器访问OSX非存储设备

我目前正在尝试在连接到我的 MacBook Pro 的 Docker 容器上运行 USB Scale 和 USB 条形码扫描仪。我了解如何在 Linux 上使用 --device 或 --privileged 标志来执行此操作,但我似乎无法弄清楚这些设备到底位于我的 mac 上的位置,因为它们不是存储设备。有任何想法吗?

macos usb barcode docker

5
推荐指数
0
解决办法
223
查看次数

标签 统计

barcode ×1

docker ×1

java ×1

junit ×1

macos ×1

maven ×1

spring ×1

spring-retry ×1

usb ×1