Author: jwross
Date: Thu Oct 11 23:05:04 2012
New Revision: 1397359
URL: http://svn.apache.org/viewvc?rev=1397359&view=rev
Log:
Test support for any location string.
Added:
aries/trunk/subsystem/subsystem-core/src/test/java/org/apache/aries/subsystem/core/internal/
aries/trunk/subsystem/subsystem-core/src/test/java/org/apache/aries/subsystem/core/internal/LocationTest.java
Added:
aries/trunk/subsystem/subsystem-core/src/test/java/org/apache/aries/subsystem/core/internal/LocationTest.java
URL:
http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/test/java/org/apache/aries/subsystem/core/internal/LocationTest.java?rev=1397359&view=auto
==============================================================================
---
aries/trunk/subsystem/subsystem-core/src/test/java/org/apache/aries/subsystem/core/internal/LocationTest.java
(added)
+++
aries/trunk/subsystem/subsystem-core/src/test/java/org/apache/aries/subsystem/core/internal/LocationTest.java
Thu Oct 11 23:05:04 2012
@@ -0,0 +1,37 @@
+package org.apache.aries.subsystem.core.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import java.net.MalformedURLException;
+
+import org.junit.Test;
+
+public class LocationTest {
+ @Test
+ public void testAnyLocationString() {
+ String locationStr = "anyLocation";
+ try {
+ Location location = new Location(locationStr);
+ assertNull("Wrong symbolic name",
location.getSymbolicName());
+ assertEquals("Wrong value", locationStr,
location.getValue());
+ assertNull("Wrong version", location.getVersion());
+ try {
+ location.open();
+ fail("Opening a location that does not
represent a URL should fail");
+ }
+ catch (MalformedURLException e) {
+ // Okay
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ fail("Wrong exception");
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ fail("Any location string must be supported");
+ }
+ }
+}