@ -28,4 +28,8 @@ public class Vector2 {
y + b.y
);
}
public Vector2 Clone() {
return new Vector2(this.x, this.y);
@ -45,4 +45,16 @@ class Vector2Test {
// assert
assertThat(expected).isEqualTo(result);
@Test
void Vector2_clone_createsClone() {
// arrange
Vector2 original = new Vector2(1, 8);
Vector2 comparator = new Vector2(1, 8);
// act
Vector2 clone = original.Clone();
original = new Vector2(11, 12);
assertThat(clone).isEqualTo(comparator);