-
Notifications
You must be signed in to change notification settings - Fork 2
/
EntityTest.java
61 lines (46 loc) · 1.71 KB
/
EntityTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package exercise;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
public class EntityTest {
@Test
public void ConeEntityTest() throws Exception {
Cone cone = new Cone(new Vec3D(1, 0, 0), 0.0, 0.0);
assertTrue(cone instanceof Geometry);
assertThat(cone.height, is(0.0));
assertThat(cone.radius, is(0.0));
}
@Test
public void AppearanceEntityTest() throws Exception {
Appearance appearance = new Appearance();
assertTrue(appearance instanceof Appearance);
}
@Test
public void GroupEntityTest() throws Exception {
Group group = new Group();
final Vec3D scale = new Vec3D(1, 1, 1);
final Vec3D translation = new Vec3D(0, 0, 0);
assertTrue(group instanceof Transform);
assertEquals(group.scale.toString(), scale.toString());
assertEquals(group.translation.toString(), translation.toString());
}
@Test
public void MaterialEntityTest() throws Exception {
Material material = new Material(new Vec3D(1, 2, 3));
assertEquals(material.diffuseColor.toString(), new Vec3D(1, 2, 3).toString());
assertTrue(material instanceof Material);
}
@Test
public void ShapeEntityTest() throws Exception {
Shape shape;
shape = new Shape();
assertTrue(shape instanceof Shape);
}
@Test
public void SphereEntityTest() throws Exception {
Sphere sphere = new Sphere(1.0, new Vec3D(1, 0, 0));
assertTrue(sphere instanceof Geometry);
//assertEquals(sphere.radius, 1.0); < ---- deprecation bug
assertEquals(sphere.center.toString(), new Vec3D(1, 0, 0).toString());
}
}