ItemUtils NPE bug fix
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
fc3b48deac
commit
0f6e46159f
@ -678,6 +678,7 @@ Include jenkins dockerfile in repo
|
|||||||
Better model for gameobjects
|
Better model for gameobjects
|
||||||
Server synchronization of sprint tree
|
Server synchronization of sprint tree
|
||||||
Fix potential bad path for item state lookup
|
Fix potential bad path for item state lookup
|
||||||
|
Fix ItemUtils NPE bug + unit test
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|||||||
@ -290,6 +290,9 @@ public class ItemUtils {
|
|||||||
* @return true if it is an item, false otherwise
|
* @return true if it is an item, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isItem(Entity e){
|
public static boolean isItem(Entity e){
|
||||||
|
if(e == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if(!e.containsKey(EntityDataStrings.ENTITY_TYPE)){
|
if(!e.containsKey(EntityDataStrings.ENTITY_TYPE)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
package electrosphere.entity.types.item;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
||||||
|
import annotations.FastTest;
|
||||||
|
import annotations.UnitTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit tests for item utils
|
||||||
|
*/
|
||||||
|
public class ItemUtilsUnitTests {
|
||||||
|
|
||||||
|
@UnitTest
|
||||||
|
@FastTest
|
||||||
|
public void isItem_NullEntity_False(){
|
||||||
|
boolean result = ItemUtils.isItem(null);
|
||||||
|
Assertions.assertEquals(false, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user