Skip to content

Commit

Permalink
Attempt to stabilise tests
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Hotze <[email protected]>
  • Loading branch information
florian-h05 committed Nov 10, 2024
1 parent 41e60af commit 86df5e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;

import java.lang.reflect.Method;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -67,7 +69,9 @@ public class AnnotationActionModuleTypeProviderTest extends JavaTest {
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
for (Class<?> parameter : TestActionProvider.class.getDeclaredMethods()[0].getParameterTypes()) {
Method method = Arrays.stream(TestActionProvider.class.getDeclaredMethods())
.filter(m -> m.getName().equals("testMethod")).findFirst().orElseThrow();
for (Class<?> parameter : method.getParameterTypes()) {
md5.update(parameter.getName().getBytes());
}
TEST_ACTION_SIGNATURE_HASH = String.format("%032x", new BigInteger(1, md5.digest()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;

import java.lang.reflect.Method;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -71,8 +73,9 @@ public class AnnotatedThingActionModuleTypeProviderTest extends JavaTest {
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
for (Class<?> parameter : AnnotatedThingActionModuleTypeProviderTest.TestThingActionProvider.class
.getDeclaredMethods()[0].getParameterTypes()) {
Method method = Arrays.stream(TestThingActionProvider.class.getDeclaredMethods())
.filter(m -> m.getName().equals("testMethod")).findFirst().orElseThrow();
for (Class<?> parameter : method.getParameterTypes()) {
md5.update(parameter.getName().getBytes());
}
TEST_ACTION_SIGNATURE_HASH = String.format("%032x", new BigInteger(1, md5.digest()));
Expand Down

0 comments on commit 86df5e0

Please sign in to comment.