Search in sources :

Example 1 with CapabilityExplosiveEntity

use of icbm.classic.lib.capability.ex.CapabilityExplosiveEntity in project ICBM-Classic by BuiltBrokenModding.

the class EntityGrenadeTest method getCapability_explosiveCap.

@Test
void getCapability_explosiveCap() {
    final EntityGrenade entityGrenade = new EntityGrenade(testManager.getWorld());
    // Mock cast as mockito is odd
    Mockito.when(ICBMClassicAPI.EXPLOSIVE_CAPABILITY.cast(entityGrenade.explosive)).thenReturn(entityGrenade.explosive);
    final IExplosive capability = entityGrenade.getCapability(ICBMClassicAPI.EXPLOSIVE_CAPABILITY, null);
    // Should return a capability for an entity
    Assertions.assertTrue(capability instanceof CapabilityExplosiveEntity, "Should have an explosive entity cap");
    final CapabilityExplosiveEntity cap = (CapabilityExplosiveEntity) capability;
    // Should contain the entity in question
    Assertions.assertSame(cap.entity, entityGrenade);
}
Also used : CapabilityExplosiveEntity(icbm.classic.lib.capability.ex.CapabilityExplosiveEntity) IExplosive(icbm.classic.api.caps.IExplosive) Test(org.junit.jupiter.api.Test)

Aggregations

IExplosive (icbm.classic.api.caps.IExplosive)1 CapabilityExplosiveEntity (icbm.classic.lib.capability.ex.CapabilityExplosiveEntity)1 Test (org.junit.jupiter.api.Test)1