You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by fr...@apache.org on 2009/02/17 20:16:54 UTC

svn commit: r745199 - in /incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire: EmpireExceptionTest.java commons/ErrorTypeTest.java commons/ErrorsTest.java commons/OptionEntryTest.java commons/StringUtilsTest.java

Author: francisdb
Date: Tue Feb 17 19:16:54 2009
New Revision: 745199

URL: http://svn.apache.org/viewvc?rev=745199&view=rev
Log:
added a test for EmpireException
Added missing apache headers

Added:
    incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/EmpireExceptionTest.java
Modified:
    incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/ErrorTypeTest.java
    incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/ErrorsTest.java
    incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/OptionEntryTest.java
    incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/StringUtilsTest.java

Added: incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/EmpireExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/EmpireExceptionTest.java?rev=745199&view=auto
==============================================================================
--- incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/EmpireExceptionTest.java (added)
+++ incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/EmpireExceptionTest.java Tue Feb 17 19:16:54 2009
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.empire;
+
+import static org.junit.Assert.*;
+
+import org.apache.empire.commons.ErrorInfo;
+import org.apache.empire.commons.ErrorObject;
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.commons.Errors;
+import org.junit.Before;
+import org.junit.Test;
+
+public class EmpireExceptionTest
+{
+
+	private final class MockErrorInfo implements ErrorInfo
+	{
+
+		public Object[] getErrorParams()
+		{
+			return new Object[] { "JUnit", "Test" };
+		}
+
+		public String getErrorSource()
+		{
+			return "JUnitSource";
+		}
+
+		public ErrorType getErrorType()
+		{
+			return Errors.IllegalFormat;
+		}
+
+		public boolean hasError()
+		{
+			return true;
+		}
+	}
+
+	private final class MockErrorObject extends ErrorObject
+	{
+		public MockErrorObject()
+		{
+			super(new MockErrorInfo());
+		}
+	}
+
+	private EmpireException exception;
+	private ErrorObject errorObject;
+
+	@Before
+	public void setupException()
+	{
+		this.errorObject = new MockErrorObject();
+		this.exception = new EmpireException(errorObject);
+	}
+
+	@Test
+	public void testToString()
+	{
+		String expected = errorObject.getClass().getName() + ": The format of JUnit is invalid for Test";
+		assertEquals(expected, exception.toString());
+	}
+
+	@Test
+	public void testGetErrorType()
+	{
+		assertEquals(Errors.IllegalFormat, exception.getErrorType());
+	}
+
+	@Test
+	public void testGetErrorObject()
+	{
+		assertEquals(errorObject, exception.getErrorObject());
+		assertSame(errorObject, exception.getErrorObject());
+	}
+
+}

Modified: incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/ErrorTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/ErrorTypeTest.java?rev=745199&r1=745198&r2=745199&view=diff
==============================================================================
--- incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/ErrorTypeTest.java (original)
+++ incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/ErrorTypeTest.java Tue Feb 17 19:16:54 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
 package org.apache.empire.commons;
 
 import static org.junit.Assert.*;

Modified: incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/ErrorsTest.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/ErrorsTest.java?rev=745199&r1=745198&r2=745199&view=diff
==============================================================================
--- incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/ErrorsTest.java (original)
+++ incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/ErrorsTest.java Tue Feb 17 19:16:54 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
 package org.apache.empire.commons;
 
 import static org.junit.Assert.*;

Modified: incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/OptionEntryTest.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/OptionEntryTest.java?rev=745199&r1=745198&r2=745199&view=diff
==============================================================================
--- incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/OptionEntryTest.java (original)
+++ incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/OptionEntryTest.java Tue Feb 17 19:16:54 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
 package org.apache.empire.commons;
 
 import static org.junit.Assert.*;

Modified: incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/StringUtilsTest.java?rev=745199&r1=745198&r2=745199&view=diff
==============================================================================
--- incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/StringUtilsTest.java (original)
+++ incubator/empire-db/branches/maven/empire-db/src/test/java/org/apache/empire/commons/StringUtilsTest.java Tue Feb 17 19:16:54 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
 package org.apache.empire.commons;
 
 import static org.junit.Assert.*;