feature: resolve #1282 for Lockable Object pattern. (#1702)

* Added Lockable-Object pattern. Closes #1282.

* Refactor method name.

* Refactor sonar lint bugs.

* Added tests and enum Constants.

* Increase coverage.

* Changed @Data to Getters and Setters.

* Iluwatar's comment on pull request #1702.

* Fixed codes mells.

* Incremented wait time to 3 seconds.

* Reduced wait time to 2 seconds.

* Cleaned Code Smells.

* Incremented wait time, removed cool down.

* Refactored README.md file.

Co-authored-by: Subhrodip Mohanta <subhrodipmohanta@gmail.com>
This commit is contained in:
Noam Greenshtain
2021-05-14 18:56:41 +03:00
committed by GitHub
parent ea3c9d955e
commit 122e6edb38
22 changed files with 1118 additions and 0 deletions
@@ -0,0 +1,24 @@
package com.iluwatar.lockableobject;
import com.iluwatar.lockableobject.domain.CreatureStats;
import com.iluwatar.lockableobject.domain.Elf;
import com.iluwatar.lockableobject.domain.Human;
import com.iluwatar.lockableobject.domain.Orc;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class SubCreaturesTests {
@Test
void statsTest(){
var elf = new Elf("Limbar");
var orc = new Orc("Dargal");
var human = new Human("Jerry");
Assertions.assertEquals(CreatureStats.ELF_HEALTH.getValue(), elf.getHealth());
Assertions.assertEquals(CreatureStats.ELF_DAMAGE.getValue(), elf.getDamage());
Assertions.assertEquals(CreatureStats.ORC_DAMAGE.getValue(), orc.getDamage());
Assertions.assertEquals(CreatureStats.ORC_HEALTH.getValue(), orc.getHealth());
Assertions.assertEquals(CreatureStats.HUMAN_DAMAGE.getValue(), human.getDamage());
Assertions.assertEquals(CreatureStats.HUMAN_HEALTH.getValue(), human.getHealth());
}
}