Package fr.neatmonster.nocheatplus.test

Source Code of fr.neatmonster.nocheatplus.test.TestConfig

package fr.neatmonster.nocheatplus.test;

import static org.junit.Assert.fail;

import org.bukkit.Material;
import org.junit.Test;

import fr.neatmonster.nocheatplus.config.RawConfigFile;

public class TestConfig {
 
  private void testReadMaterial(String input, Material expectedMat) {
    Material mat = RawConfigFile.parseMaterial(input);
    if (expectedMat != mat) {
      fail("Expected " + expectedMat + " for input '" + input + "', got instead: " + mat);
    }
  }
 
  @SuppressWarnings("deprecation")
  @Test
  public void testReadMaterial() {
    // Some really needed parts first.
    testReadMaterial("water lily", Material.WATER_LILY);
    testReadMaterial("water-lily", Material.WATER_LILY);
    testReadMaterial("watEr_lily", Material.WATER_LILY);
   
    testReadMaterial("flint and steel", Material.FLINT_AND_STEEL);
    testReadMaterial("259", Material.FLINT_AND_STEEL);
   
    // Generic test.
    for (final Material mat : Material.values()) {
      if (mat.name().equalsIgnoreCase("LOCKED_CHEST")) {
        continue;
      }
      testReadMaterial(mat.name(), mat);
      testReadMaterial(Integer.toString(mat.getId()), mat);
    }
   
  }
}
TOP

Related Classes of fr.neatmonster.nocheatplus.test.TestConfig

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.