diff --git a/src/main/java/io/specto/hoverfly/junit/core/SystemConfigFactory.java b/src/main/java/io/specto/hoverfly/junit/core/SystemConfigFactory.java index 7ddd52ac..35287935 100644 --- a/src/main/java/io/specto/hoverfly/junit/core/SystemConfigFactory.java +++ b/src/main/java/io/specto/hoverfly/junit/core/SystemConfigFactory.java @@ -36,7 +36,11 @@ SystemConfig createSystemConfig() { } if (systemInfo.is64BitSystem()) { - archType = ArchType.ARCH_AMD64; + if (systemInfo.isOsLinux() && systemInfo.isArmArchitecture()) { + archType = ArchType.ARCH_ARM64; + } else { + archType = ArchType.ARCH_AMD64; + } } else { archType = ArchType.ARCH_386; } @@ -66,6 +70,7 @@ String getName() { enum ArchType { ARCH_AMD64("amd64"), + ARCH_ARM64("arm64"), ARCH_386("386"); private final String name; diff --git a/src/main/java/io/specto/hoverfly/junit/core/SystemInfo.java b/src/main/java/io/specto/hoverfly/junit/core/SystemInfo.java index a728cece..b82dfb4a 100644 --- a/src/main/java/io/specto/hoverfly/junit/core/SystemInfo.java +++ b/src/main/java/io/specto/hoverfly/junit/core/SystemInfo.java @@ -11,6 +11,7 @@ class SystemInfo { private final boolean isOsMac = SystemUtils.IS_OS_MAC; private final boolean isOsLinux = SystemUtils.IS_OS_LINUX; private final boolean is64BitSystem = SystemUtils.OS_ARCH.contains("64"); + private final boolean isArmArchitecture = SystemUtils.OS_ARCH.contains("aarch"); private final String osName = SystemUtils.OS_NAME; boolean isOsWindows() { @@ -29,6 +30,10 @@ boolean is64BitSystem() { return is64BitSystem; } + boolean isArmArchitecture() { + return isArmArchitecture; + } + String getOsName() { return osName; } diff --git a/src/test/java/io/specto/hoverfly/junit/core/SystemConfigFactoryTest.java b/src/test/java/io/specto/hoverfly/junit/core/SystemConfigFactoryTest.java index bdbdd401..e7e8360b 100644 --- a/src/test/java/io/specto/hoverfly/junit/core/SystemConfigFactoryTest.java +++ b/src/test/java/io/specto/hoverfly/junit/core/SystemConfigFactoryTest.java @@ -6,8 +6,7 @@ import org.junit.Test; import org.powermock.reflect.Whitebox; -import static io.specto.hoverfly.junit.core.SystemConfigFactory.ArchType.ARCH_386; -import static io.specto.hoverfly.junit.core.SystemConfigFactory.ArchType.ARCH_AMD64; +import static io.specto.hoverfly.junit.core.SystemConfigFactory.ArchType.*; import static io.specto.hoverfly.junit.core.SystemConfigFactory.OsName.*; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; @@ -46,6 +45,18 @@ public void shouldCreateSystemConfigForLinux() { assertThat(systemConfig.getOsName()).isEqualTo(LINUX); } + @Test + public void shouldCreateSystemConfigWithArm64BitArchType() { + + when(systemInfo.isOsLinux()).thenReturn(true); + when(systemInfo.is64BitSystem()).thenReturn(true); + when(systemInfo.isArmArchitecture()).thenReturn(true); + + SystemConfig systemConfig = factory.createSystemConfig(); + + assertThat(systemConfig.getArchType()).isEqualTo(ARCH_ARM64); + } + @Test public void shouldCreateSystemConfigForMac() {