Author: msacks
Date: Thu Jun  2 18:17:53 2011
New Revision: 1130700

URL: http://svn.apache.org/viewvc?rev=1130700&view=rev
Log:
committing tests in kitty-17.patch.

Added:
    incubator/kitty/trunk/src/test/java/org/apache/kitty/client/
    
incubator/kitty/trunk/src/test/java/org/apache/kitty/client/ClientTest.groovy

Added: 
incubator/kitty/trunk/src/test/java/org/apache/kitty/client/ClientTest.groovy
URL: 
http://svn.apache.org/viewvc/incubator/kitty/trunk/src/test/java/org/apache/kitty/client/ClientTest.groovy?rev=1130700&view=auto
==============================================================================
--- 
incubator/kitty/trunk/src/test/java/org/apache/kitty/client/ClientTest.groovy 
(added)
+++ 
incubator/kitty/trunk/src/test/java/org/apache/kitty/client/ClientTest.groovy 
Thu Jun  2 18:17:53 2011
@@ -0,0 +1,58 @@
+/*
+ * 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.kitty.client;
+
+import static org.junit.Assert.*;
+import org.apache.kitty.client.Client
+import javax.management.MBeanServerConnection
+import org.junit.Test;
+
+class ClientTest {
+
+    @Test
+    public void should_correctly_set_a_new_domain_value() {
+        def mbean_server_connection = {
+            ['a', 'b', 'c']as String[]
+        } as MBeanServerConnection
+        Client client = new Client()
+        client.remote = mbean_server_connection
+
+        assert client.domain == null
+        assert client.mBeansPath == null
+
+        client.setDomain 'a'
+
+        assert client.domain == 'a'
+        assert client.mBeansPath == []
+    }
+
+    @Test
+    public void 
should_keep_actual_domain_when_trying_to_set_it_with_invalid_value() throws 
Exception {
+        def mbean_server_connection = {
+            ['a', 'b', 'c']as String[]
+        } as MBeanServerConnection
+        Client client = new Client()
+        client.remote = mbean_server_connection
+        client.domain = 'a'
+        client.mBeansPath = []
+
+        client.setDomain 'invalid_value'
+
+        assert client.domain == 'a'
+    }
+}


Reply via email to