/*
 * Copyright (C) 2004-2007  exedio GmbH (www.exedio.com)
 *
 * This library 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 2.1 of the License, or (at your option) any later version.
 *
 * This library 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 along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package com.exedio.cope.instrument;

import java.lang.reflect.Modifier;

public class Example15Test extends InjectorTest
{

	// TODO spaces in generics
	// TODO constructor with generics
	// TODO enums
	// TODO annotations

	public Example15Test()
	{
		super("Example15.java", false);
	}

	@Override
	public void assertInjection()
	{
		assertPackage("com.exedio.cope.instrument");

		assertImport("java.util.Date");
		assertImport("java.util.HashMap");
		assertImport("java.util.HashSet");

		final JavaClass exampleClass = assertClass("Example15", null, null);

		final JavaAttribute name =
			assertAttributeHeader("name", "String", Modifier.PRIVATE);
		assertAttribute("name", null, name);

		final JavaAttribute dates =
			assertAttributeHeader("dates", "HashSet<Date>", Modifier.PUBLIC);
		assertAttribute("dates", null, dates);

		final JavaAttribute primes =
			assertAttributeHeader("primes", "HashMap<Integer, Boolean>", 0);
		assertAttribute("primes", null, primes);

		final JavaBehaviour constructor =
			assertBehaviourHeader("Example15", null, Modifier.PUBLIC);
		assertMethod("Example15", null, constructor);
		
		final JavaBehaviour setter =
			assertBehaviourHeader("set", "void", Modifier.PUBLIC);
		assertMethod("set", null, setter);

		final JavaBehaviour getDates =
			assertBehaviourHeader("getDates", "HashSet<Date>", Modifier.PRIVATE);
		assertMethod("getDates", null, getDates);

		final JavaBehaviour getPrimes =
			assertBehaviourHeader("getPrimes", "HashMap<Integer, Boolean>", 0);
		assertMethod("getPrimes", null, getPrimes);

		final JavaClass colorClass = assertClass("Color", null, null, exampleClass);
		assertClassEnd(colorClass);
		assertInnerClassAttribute("Color", null);
		
		final JavaClass weekdayClass = assertClass("Weekday", null, null, exampleClass);
		assertClassEnd(weekdayClass);
		assertInnerClassAttribute("Weekday", null);
		
		final JavaBehaviour equalsMethod =
			assertBehaviourHeader("equals", "boolean", 0 /* TODO should be Modifier.PUBLIC */);
		assertMethod("equals", null, equalsMethod);

		assertClassEnd(exampleClass);
	}

}

@@ -841,16 +841,23 @@
 %0Aimport 
+static 
 java.lan
@@ -874,16 +874,73 @@
 Modifier
+.PUBLIC;%0Aimport static java.lang.reflect.Modifier.PRIVATE
 ;%0A%0Apubli
@@ -1496,25 +1496,16 @@
 tring%22, 
-Modifier.
 PRIVATE)
@@ -1627,25 +1627,16 @@
 Date%3E%22, 
-Modifier.
 PUBLIC);
@@ -1901,25 +1901,16 @@
 , null, 
-Modifier.
 PUBLIC);
@@ -2032,25 +2032,16 @@
 %22void%22, 
-Modifier.
 PUBLIC);
@@ -2166,25 +2166,16 @@
 Date%3E%22, 
-Modifier.
 PRIVATE)
@@ -2730,16 +2730,16 @@
 ethod =%0A
+
 %09%09%09asser
@@ -2796,25 +2796,16 @@
 ould be 
-Modifier.
 PUBLIC *

use static imports