commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons/betwixt/src/test/org/apache/commons/betwixt TestBeanReader.java
Date Mon, 29 Mar 2004 20:50:21 GMT
rdonkin     2004/03/29 12:50:21

  Modified:    betwixt/src/java/org/apache/commons/betwixt/expression Tag:
                        REFACTORING-BRANCH_2004-01-13 MapEntryAdder.java
               betwixt/src/test/org/apache/commons/betwixt Tag:
                        REFACTORING-BRANCH_2004-01-13 TestBeanReader.java
  Log:
  Fix for bug in map adder type conversion. Patch contributed by Brian Pugh.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.4.2.1   +6 -6      jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/expression/MapEntryAdder.java
  
  Index: MapEntryAdder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/expression/MapEntryAdder.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- MapEntryAdder.java	9 Oct 2003 20:52:04 -0000	1.4
  +++ MapEntryAdder.java	29 Mar 2004 20:50:21 -0000	1.4.2.1
  @@ -235,13 +235,13 @@
               if ( key instanceof String ) {
                   // try to convert into primitive types
                   key = context.getObjectStringConverter()
  -                        .stringToObject( (String) key, valueType, null, context );
  +                        .stringToObject( (String) key, keyType, null, context );
               }
               
               if ( value instanceof String ) {
                   // try to convert into primitive types
                   value = context.getObjectStringConverter()
  -                        .stringToObject( (String) value, keyType, null, context );
  +                        .stringToObject( (String) value, valueType, null, context );
               }
                    
               Object[] arguments = { key, value };
  
  
  
  No                   revision
  No                   revision
  1.21.2.4  +21 -1     jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestBeanReader.java
  
  Index: TestBeanReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestBeanReader.java,v
  retrieving revision 1.21.2.3
  retrieving revision 1.21.2.4
  diff -u -r1.21.2.3 -r1.21.2.4
  --- TestBeanReader.java	18 Jan 2004 22:25:23 -0000	1.21.2.3
  +++ TestBeanReader.java	29 Mar 2004 20:50:21 -0000	1.21.2.4
  @@ -686,7 +686,27 @@
           assertEquals("Bad address (11)",  "United Kingdom", address.getCountry());
           assertEquals("Bad address (12)", "BD18 2BJ", address.getCode());
       }
  -    
  +
  +  public void testReadMap2() throws Exception{
  +    IdMap idMap = new IdMap();
  +    String id ="3920";
  +    idMap.addId(id, new Integer(1));
  +    StringWriter outputWriter = new StringWriter();
  +    outputWriter.write("<?xml version='1.0' ?>\n");
  +    BeanWriter beanWriter = new BeanWriter(outputWriter);
  +    beanWriter.write(idMap);
  +    String xml = outputWriter.toString();
  +    System.out.println("Map test: " + xml);
  +
  +    BeanReader beanReader = new BeanReader();
  +    beanReader.registerBeanClass(IdMap.class);
  +    IdMap result = (IdMap)beanReader.parse(new StringReader(xml));
  +    assertNotNull("didn't get an object back!", result);
  +    assertNotNull("didn't get a Map out of the IdMap!", result.getIds());
  +    assertEquals("Got the Map, but doesn't have an entry!", 1, result.getIds().size());
  +    assertNotNull("Got the Map, but doesn't have correct values!", result.getIds().get(id));
  +  }
  +
       public void testIndirectReference() throws Exception
       {	
           Tweedledum dum = new Tweedledum();
  
  
  

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


Mime
View raw message