2012-09-26 16:34:06 -05:00
|
|
|
package org.bukkit;
|
|
|
|
|
2019-04-23 14:54:36 +10:00
|
|
|
import static org.hamcrest.Matchers.*;
|
|
|
|
import static org.junit.Assert.*;
|
2021-03-16 09:00:00 +11:00
|
|
|
import net.minecraft.core.IRegistry;
|
|
|
|
import net.minecraft.resources.MinecraftKey;
|
2012-09-26 16:34:06 -05:00
|
|
|
import org.bukkit.craftbukkit.CraftSound;
|
2018-08-26 20:44:50 +10:00
|
|
|
import org.bukkit.support.AbstractTestingBase;
|
2012-09-26 16:34:06 -05:00
|
|
|
import org.junit.Test;
|
|
|
|
|
2018-08-26 20:44:50 +10:00
|
|
|
public class SoundTest extends AbstractTestingBase {
|
2012-09-26 16:34:06 -05:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testGetSound() {
|
|
|
|
for (Sound sound : Sound.values()) {
|
2020-11-26 09:36:57 +11:00
|
|
|
assertThat(sound.name(), CraftSound.getSoundEffect(sound), is(not(nullValue())));
|
2012-09-26 16:34:06 -05:00
|
|
|
}
|
|
|
|
}
|
2016-03-01 08:32:46 +11:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testReverse() {
|
2018-08-26 12:00:00 +10:00
|
|
|
for (MinecraftKey effect : IRegistry.SOUND_EVENT.keySet()) {
|
2021-11-22 09:00:00 +11:00
|
|
|
assertNotNull(effect + "", Sound.valueOf(effect.getPath().replace('.', '_').toUpperCase(java.util.Locale.ENGLISH)));
|
2016-03-01 08:32:46 +11:00
|
|
|
}
|
|
|
|
}
|
2016-11-19 14:27:18 +11:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testCategory() {
|
|
|
|
for (SoundCategory category : SoundCategory.values()) {
|
2021-03-16 09:00:00 +11:00
|
|
|
assertNotNull(category + "", net.minecraft.sounds.SoundCategory.valueOf(category.name()));
|
2016-11-19 14:27:18 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testCategoryReverse() {
|
2021-03-16 09:00:00 +11:00
|
|
|
for (net.minecraft.sounds.SoundCategory category : net.minecraft.sounds.SoundCategory.values()) {
|
2016-11-19 14:27:18 +11:00
|
|
|
assertNotNull(category + "", SoundCategory.valueOf(category.name()));
|
|
|
|
}
|
|
|
|
}
|
2012-09-26 16:34:06 -05:00
|
|
|
}
|