DATADOC-162 - Added more test cases around Point class.

This commit is contained in:
Oliver Gierke
2011-06-13 09:48:18 -07:00
parent fa094eef25
commit b1ab3f6ade

View File

@@ -0,0 +1,31 @@
package org.springframework.data.document.mongodb.geo;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Test;
/**
* Unit tests for {@link Point}.
*
* @author Oliver Gierke
*/
public class PointUnitTests {
@Test(expected = IllegalArgumentException.class)
public void rejectsNullforCopyConstructor() {
new Point(null);
}
@Test
public void equalsIsImplementedCorrectly() {
assertThat(new Point(1.5, 1.5), is(equalTo(new Point(1.5, 1.5))));
assertThat(new Point(1.5, 1.5), is(not(equalTo(new Point(2.0, 2.0)))));
assertThat(new Point(2.0, 2.0), is(not(equalTo(new Point(1.5, 1.5)))));
}
@Test
public void invokingToStringWorksCorrectly() {
new Point(1.5, 1.5).toString();
}
}