Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. package Tests;
  2.  
  3. import Main.Rechthoek;
  4. import Main.Vierkant;
  5. import org.junit.Before;
  6. import org.junit.Test;
  7.  
  8. import static org.hamcrest.CoreMatchers.instanceOf;
  9. import static org.hamcrest.CoreMatchers.is;
  10. import static org.junit.Assert.assertThat;
  11.  
  12. public class VierkantTest {
  13.  
  14. private Vierkant obj;
  15.  
  16. @Before
  17. public void setUp() {
  18. this.obj = new Vierkant();
  19. }
  20.  
  21. @Test
  22. public void test_creationOfObjectClassRechthoek_ObjectOfClassRechthoek() {
  23. assertThat(this.obj, instanceOf(Rechthoek.class));
  24. }
  25.  
  26. @Test
  27. public void test_getLengte_LengthIsZero() {
  28.  
  29. // arrange
  30. int expectedReturnValue = 0;
  31.  
  32. // act
  33. int actualValue = obj.getLengte();
  34.  
  35. // assert
  36. assertThat(actualValue, is(expectedReturnValue));
  37. }
  38.  
  39. @Test
  40. public void test_GetBreedte_BreedteIsZero() {
  41.  
  42. // arrange
  43. int expectedReturnValue = 0;
  44.  
  45. // act
  46. int actualValue = obj.getBreedte();
  47.  
  48. // assert
  49. assertThat(actualValue, is(expectedReturnValue));
  50. }
  51.  
  52. @Test
  53. public void test_setBreedteIsZero_getBreedteIsZero() {
  54.  
  55. // arrange
  56. int expectedReturnValue = 0;
  57.  
  58. // act
  59. this.obj.setBreedte(0);
  60. int actualValue = this.obj.getBreedte();
  61.  
  62. // assert
  63. assertThat(actualValue, is(expectedReturnValue));
  64.  
  65. }
  66.  
  67. @Test
  68. public void test_setBreedteIsTen_getBreedteIsTen() {
  69. int expected = 10;
  70.  
  71. this.obj.setLength(10);
  72. int actual = this.obj.getLengte();
  73.  
  74. assertThat(actual, is(expected));
  75.  
  76. }
  77.  
  78. @Test
  79. public void test_setLengthIsZero_getLengthIsZero() {
  80. int expected = 0;
  81.  
  82. this.obj.setLength(0);
  83. int actual = this.obj.getLengte();
  84.  
  85. assertThat(actual, is(expected));
  86.  
  87. }
  88.  
  89. @Test
  90. public void test_setLengthIsTen_getLengthIsTen() {
  91. int expected = 10;
  92.  
  93. this.obj.setLength(10);
  94. int actual = this.obj.getLengte();
  95.  
  96. assertThat(actual, is(expected));
  97.  
  98. }
  99.  
  100. @Test
  101. public void test_getOppervlakte_OppervlakteIs100() {
  102. // Arrange
  103. int expected = 100;
  104.  
  105. // Act
  106. this.obj.setLength(10);
  107. this.obj.setBreedte(10);
  108. int actual = this.obj.getOppervlakte();
  109.  
  110. // Assert
  111. assertThat(actual, is(expected));
  112. }
  113.  
  114.  
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement