hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-hivemind/framework/src/test/org/apache/hivemind/schema/rules TestIdTranslators.java
Date Wed, 09 Jun 2004 14:48:56 GMT
hlship      2004/06/09 07:48:56

  Added:       framework/src/test/org/apache/hivemind/schema/rules
                        TestIdTranslators.java
  Log:
  Add two new translators: qualified-id and id-list.
  
  Revision  Changes    Path
  1.1                  jakarta-hivemind/framework/src/test/org/apache/hivemind/schema/rules/TestIdTranslators.java
  
  Index: TestIdTranslators.java
  ===================================================================
  //  Copyright 2004 The Apache Software Foundation
  //
  // 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.
  
  package org.apache.hivemind.schema.rules;
  
  import org.apache.hivemind.internal.Module;
  import org.apache.hivemind.schema.Translator;
  import org.apache.hivemind.test.HiveMindTestCase;
  import org.easymock.MockControl;
  
  /**
   * Tests for {@link org.apache.hivemind.schema.rules.QualifiedIdTranslator}
   * and {@link org.apache.hivemind.schema.rules.IdListTranslator}.
   *
   * @author Howard Lewis Ship
   */
  public class TestIdTranslators extends HiveMindTestCase
  {
      public void testNullId()
      {
          Translator t = new QualifiedIdTranslator();
  
          assertNull(t.translate(null, null, null));
      }
  
      public void testNonNullId()
      {
          MockControl c = MockControl.createStrictControl(Module.class);
          Module m = (Module) c.getMock();
  
          m.getModuleId();
          c.setReturnValue("foo.bar");
  
          c.replay();
  
          Translator t = new QualifiedIdTranslator();
  
          assertEquals("foo.bar.Baz", t.translate(m, null, "Baz"));
  
          c.verify();
      }
  
      public void testNullList()
      {
          Translator t = new IdListTranslator();
  
          assertEquals(null, t.translate(null, null, null));
      }
  
      public void testNonNullList()
      {
          MockControl c = MockControl.createStrictControl(Module.class);
          Module m = (Module) c.getMock();
  
          m.getModuleId();
          c.setReturnValue("foo.bar");
  
          c.replay();
  
          Translator t = new IdListTranslator();
  
          assertEquals("foo.bar.Baz,zip.Zap", t.translate(m, null, "Baz,zip.Zap"));
  
          c.verify();
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org


Mime
View raw message