/*
 * Java Genetic Algorithm Library (@__identifier__@).
 * Copyright (c) @__year__@ Franz Wilhelmstötter
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Author:
 *    Franz Wilhelmstötter (franz.wilhelmstoetter@gmx.at)
 */
package org.jenetics.util;

import org.testng.Assert;
import org.testng.annotations.Test;

import org.jenetics.internal.util.require;

/**
 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
 */
public class StaticObjectTest {

	@Test
	public void instantiation() throws Exception {
		try {
			new SomeStaticObject();
			Assert.assertFalse(true);
		} catch (AssertionError e) {
			final String expected = String.format(
				"Instantiation of '%s' is not allowed.",
				"org.jenetics.util.SomeStaticObject"
			);

			Assert.assertEquals(e.getMessage(), expected);
		}

		try {
			SomeStaticObject.class.getConstructor().newInstance();
			Assert.assertFalse(true);
		} catch (AssertionError e) {
			final String expected = String.format(
				"Instantiation of '%s' is not allowed.",
				"org.jenetics.util.SomeStaticObject"
			);

			Assert.assertEquals(e.getMessage(), expected);
		}
	}

}

final class SomeStaticObject {
	SomeStaticObject() {require.noInstance();}
}

@@ -762,16 +762,69 @@
 .util;%0A%0A
+import java.lang.reflect.InvocationTargetException;%0A%0A
 import o
@@ -1065,17 +1065,28 @@
 ic void 
-i
+constructorI
 nstantia
@@ -1395,16 +1395,84 @@
 d);%0A%09%09%7D%0A
+%09%7D%0A%0A%09@Test%0A%09public void reflectiveInstantiation() throws Exception %7B
 %0A%09%09try %7B
@@ -1501,16 +1501,24 @@
 lass.get
+Declared
 Construc
@@ -1574,38 +1574,49 @@
 %0A%09%09%7D catch (
-AssertionError
+InvocationTargetException
  e) %7B%0A%09%09%09fin
@@ -1761,32 +1761,53 @@
 .assertEquals(e.
+getTargetException().
 getMessage(), ex

Fix 'StaticObjectTest' unit test.