### Question:
Physics { public static PVector calculateImpulse(PVector v1, PVector v2, float m1, float m2, float elasticity, PVector normal) { assert v1 != null : "Physics.calculateImpulse: v1 must be a valid PVector"; assert v2 != null : "Physics.calculateImpulse: v2 must be a valid PVector"; assert normal != null : "Physics.calculateImpulse: normal must be a valid PVector"; assert !(normal.x == 0 && normal.y == 0) : "Physics.calculateImpulse: normal must be nonzero"; PVector numerator = PVector.sub(v2, v1); numerator.mult(-1 - elasticity); float result = numerator.dot(normal); result /= normal.dot(normal); result /= (1 / m1 + 1 / m2); return PVector.mult(normal, result); }  static PVector calculateImpulse(PVector v1, PVector v2, 
			float m1, float m2, float elasticity, PVector normal); static PVector calculateImpulse(MassedBeing being1, MassedBeing being2, 
			float elasticity, PVector normal);  }### Answer:
@Test public void test_calculateImpulse() { MassedBeing being1 = new MyBeing(1.0f, 1.0f); MassedBeing being2 = new MyBeing(1.0f, 1.0f); being1.setPosition(zeroVector()); being1.setVelocity(zeroVector()); being2.setPosition(makeVector(-1.0f,0.0f)); being2.setVelocity(makeVector(1.0f,0.0f)); PVector impulse = Physics.calculateImpulse(being1, being2, 1.0f, makeVector(-1.0f,0.0f)); assertEquals(impulse.x, -1.0f, 1e-8); assertEquals(impulse.y, 0.0f, 1e-8); impulse = Physics.calculateImpulse(being2, being1, 1.0f, makeVector(-1.0f,0.0f)); assertEquals(impulse.x, 1.0f, 1e-8); assertEquals(impulse.y, 0.0f, 1e-8); impulse = Physics.calculateImpulse(being1, being2, 1.0f, makeVector(-10.0f,0.0f)); assertEquals(impulse.x, -1.0f, 1e-8); assertEquals(impulse.y, 0.0f, 1e-8); being1.setMass(2.0f); impulse = Physics.calculateImpulse(being1, being2, 1.0f, makeVector(-1.0f,0.0f)); assertEquals(impulse.x, -4.0 / 3.0, 1e-5); assertEquals(impulse.y, 0.0f, 1e-5); being1.setVelocity(makeVector(1,0)); being2.setVelocity(makeVector(2,0)); impulse = Physics.calculateImpulse(being1, being2, 1.0f, makeVector(-1.0f,0.0f)); assertEquals(impulse.x, -4.0 / 3.0, 1e-5); assertEquals(impulse.y, 0.0f, 1e-5); }