test: fix integration credential CI compilation

This commit is contained in:
nxhlz 2026-08-15 15:42:45 +08:00
parent 0fc3637ac5
commit aafc836f5c
2 changed files with 3 additions and 3 deletions

View file

@ -31,7 +31,7 @@ class IntegrationCredentialFilterTest {
}
@Test
void acceptsOnlyAValidBearerCredentialWithoutEchoingIt() {
void acceptsOnlyAValidBearerCredentialWithoutEchoingIt() throws Exception {
String token = "xzi_0123456789abcdef0123456789abcdef.test-secret-material-never-production";
IntegrationCredentialService service = mock(IntegrationCredentialService.class);
IntegrationPrincipal principal = new IntegrationPrincipal("credential-1", "explorer", 41L);

View file

@ -29,7 +29,7 @@ class IntegrationCredentialServiceImplTest {
IntegrationCredentialDao dao = mock(IntegrationCredentialDao.class);
SysUserService users = activeUsers();
AtomicReference<IntegrationCredentialEntity> persisted = new AtomicReference<>();
when(dao.insert(any())).thenAnswer(invocation -> {
when(dao.insert(any(IntegrationCredentialEntity.class))).thenAnswer(invocation -> {
persisted.set(invocation.getArgument(0));
return 1;
});
@ -59,7 +59,7 @@ class IntegrationCredentialServiceImplTest {
SysUserService users = activeUsers();
IntegrationCredentialServiceImpl service = new IntegrationCredentialServiceImpl(dao, users);
ArgumentCaptor<IntegrationCredentialEntity> inserted = ArgumentCaptor.forClass(IntegrationCredentialEntity.class);
when(dao.insert(any())).thenReturn(1);
when(dao.insert(any(IntegrationCredentialEntity.class))).thenReturn(1);
IntegrationCredentialService.CreatedIntegrationCredential created = service
.createExplorerCredential("Explorer", OWNER_USER_ID, null, ACTOR_USER_ID);
verify(dao).insert(inserted.capture());