* bael-1612

* line
This commit is contained in:
myluckagain
2018-03-23 18:36:49 +05:00
committed by KevinGilmore
parent f948ea0f46
commit 2840347d60
5 changed files with 69 additions and 0 deletions
@@ -0,0 +1,33 @@
package com.baeldung.finalkeyword;
import org.junit.Test;
import static org.junit.Assert.*;
public class FinalUnitTest {
@Test
public void whenChangedFinalClassProperties_thenChanged() {
Cat cat = new Cat();
cat.setWeight(1);
assertEquals(1, cat.getWeight());
}
@Test
public void whenFinalVariableAssign_thenOnlyOnce() {
final int i;
i = 1;
// i=2;
}
@Test
public void whenChangedFinalReference_thenChanged() {
final Cat cat = new Cat();
// cat=new Cat();
cat.setWeight(5);
assertEquals(5, cat.getWeight());
}
}