Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/java/test/org/openqa/selenium/PointTest.java
1865 views
1
// Licensed to the Software Freedom Conservancy (SFC) under one
2
// or more contributor license agreements. See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership. The SFC licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License. You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied. See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
package org.openqa.selenium;
19
20
import static org.assertj.core.api.Assertions.assertThat;
21
22
import org.junit.jupiter.api.Tag;
23
import org.junit.jupiter.api.Test;
24
25
/** Tests WebDriver's Point class. */
26
@Tag("UnitTests")
27
class PointTest {
28
29
@Test
30
void testSimpleAssignment() {
31
Point p1 = new Point(30, 50);
32
assertThat(p1.getX()).isEqualTo(30);
33
assertThat(p1.getY()).isEqualTo(50);
34
}
35
36
@Test
37
void testEquality() {
38
Point p1 = new Point(30, 60);
39
Point p2 = new Point(40, 60);
40
41
assertThat(p1).isNotEqualTo(p2);
42
// Doesn't have to be different, but known to be different for this case.
43
assertThat(p1.hashCode()).isNotEqualTo(p2.hashCode());
44
45
Point p1copy = new Point(30, 60);
46
47
assertThat(p1copy).isEqualTo(p1);
48
assertThat(p1copy.hashCode()).isEqualTo(p1.hashCode());
49
}
50
51
@Test
52
void testMoveBy() {
53
Point p1 = new Point(31, 42);
54
55
assertThat(p1.moveBy(4, 5)).isEqualTo(new Point(35, 47));
56
}
57
}
58
59