Path: blob/trunk/java/test/org/openqa/selenium/ArchitectureTest.java
1865 views
// Licensed to the Software Freedom Conservancy (SFC) under one1// or more contributor license agreements. See the NOTICE file2// distributed with this work for additional information3// regarding copyright ownership. The SFC licenses this file4// to you under the Apache License, Version 2.0 (the5// "License"); you may not use this file except in compliance6// with the License. You may obtain a copy of the License at7//8// http://www.apache.org/licenses/LICENSE-2.09//10// Unless required by applicable law or agreed to in writing,11// software distributed under the License is distributed on an12// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13// KIND, either express or implied. See the License for the14// specific language governing permissions and limitations15// under the License.1617package org.openqa.selenium;1819import static org.assertj.core.api.Assertions.assertThat;20import static org.assertj.core.api.Assertions.assertThatExceptionOfType;21import static org.openqa.selenium.Architecture.ANY;22import static org.openqa.selenium.Architecture.ARM;23import static org.openqa.selenium.Architecture.X64;24import static org.openqa.selenium.Architecture.X86;2526import org.junit.jupiter.api.Tag;27import org.junit.jupiter.api.Test;2829@Tag("UnitTests")30class ArchitectureTest {3132@Test33void anyMatchesX86() {34assertThat(ANY.is(X86)).isTrue();35}3637@Test38void anyMatchesX64() {39assertThat(ANY.is(X64)).isTrue();40}4142@Test43void anyMatchesARM() {44assertThat(ANY.is(ARM)).isTrue();45}4647@Test48void anyMatchesANY() {49assertThat(ANY.is(ANY)).isTrue();50}5152@Test53void currentArchitecture() {54Architecture current = Architecture.getCurrent();55assertThat(current).isNotNull();56assertThat(current.is(ANY)).isFalse();57}5859@Test60void determineArchI386() {61assertThat(Architecture.extractFromSysProperty("i386").is(X86)).isTrue();62}6364@Test65void determineArchIA32() {66assertThat(Architecture.extractFromSysProperty("ia32").is(X86)).isTrue();67}6869@Test70void determineArchI686() {71assertThat(Architecture.extractFromSysProperty("i686").is(X86)).isTrue();72}7374@Test75void determineArchI486() {76assertThat(Architecture.extractFromSysProperty("i486").is(X86)).isTrue();77}7879@Test80void determineArchI86() {81assertThat(Architecture.extractFromSysProperty("i86").is(X86)).isTrue();82}8384@Test85void determineArchPentium() {86assertThat(Architecture.extractFromSysProperty("pentium").is(X86)).isTrue();87}8889@Test90void determineArchPentiumPro() {91assertThat(Architecture.extractFromSysProperty("pentium_pro").is(X86)).isTrue();92}9394@Test95void determineArchPentiumProMmx() {96assertThat(Architecture.extractFromSysProperty("pentium_pro+mmx").is(X86)).isTrue();97}9899@Test100void determineArchPentiumMmx() {101assertThat(Architecture.extractFromSysProperty("pentium+mmx").is(X86)).isTrue();102}103104@Test105void determineArchAMD64() {106assertThat(Architecture.extractFromSysProperty("amd64").is(X64)).isTrue();107}108109@Test110void determineArchIA64() {111assertThat(Architecture.extractFromSysProperty("ia64").is(X64)).isTrue();112}113114@Test115void determineArchARM() {116assertThat(Architecture.extractFromSysProperty("arm").is(ARM)).isTrue();117}118119@Test120void determineArchEmpty() {121assertThatExceptionOfType(UnsupportedOperationException.class)122.isThrownBy(() -> Architecture.extractFromSysProperty(""))123.withMessageContaining("Unknown architecture");124}125126@Test127void determineArchBogus() {128assertThatExceptionOfType(UnsupportedOperationException.class)129.isThrownBy(() -> Architecture.extractFromSysProperty("hoobaflooba"))130.withMessageContaining("Unknown architecture");131}132133@Test134void determineArchMixedCasing() {135assertThat(Architecture.extractFromSysProperty("AmD64").is(X64)).isTrue();136}137138@Test139void dataModelIs32Or64BitOnCurrentArchitecture() {140int model = Architecture.getCurrent().getDataModel();141assertThat(model == 32 || model == 64).isTrue();142}143144@Test145void x86DataModelIs32Bit() {146assertThat(X86.getDataModel()).isEqualTo(32);147}148149@Test150void x64DataModelIs64Bit() {151assertThat(X64.getDataModel()).isEqualTo(64);152}153154@Test155void armDataModelIs64Bit() {156assertThat(ARM.getDataModel()).isEqualTo(64);157}158159@Test160void anyDataModelIs64Bit() {161assertThat(ANY.getDataModel()).isEqualTo(64);162}163}164165166