Skip to content

Instantly share code, notes, and snippets.

@LunNova
Created May 16, 2012 19:07
Show Gist options
  • Select an option

  • Save LunNova/2713104 to your computer and use it in GitHub Desktop.

Select an option

Save LunNova/2713104 to your computer and use it in GitHub Desktop.
/*
* This file is part of Vanilla.
*
* Copyright (c) 2011-2012, SpoutDev <http://www.spout.org/>
* Vanilla is licensed under the SpoutDev License Version 1.
*
* Vanilla is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition, 180 days after any changes are published, you can use the
* software, incorporating those changes, under the terms of the MIT license,
* as described in the SpoutDev License Version 1.
*
* Vanilla is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License,
* the MIT license and the SpoutDev License Version 1 along with this program.
* If not, see <http://www.gnu.org/licenses/> for the GNU Lesser General Public
* License and see <http://www.spout.org/SpoutDevLicenseV1.txt> for the full license,
* including the MIT license.
*/
package org.spout.vanilla;
import org.junit.Test;
import org.spout.vanilla.material.VanillaMaterials;
import static org.junit.Assert.assertEquals;
public class fuckedUpStaticInitialisationOrderTest {
@Test
public void materialStaticInitialisationTest() {
boolean result = true;
try{
doNothing(VanillaMaterials.POTION);
} catch(Exception e) {
result = false; //Exception type does not matter! Static initialisation failure loses the exception data, turns into ClassLoader fail. :(
}
assertEquals("Static initialisation of VanillaMaterials failed! WHAT DID YOU DO?!",result,true);//Classloader exception if fails.
}
public static boolean doNothing(Object o) {//Prevents java optimising stuff out.
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment