### Question:
Namespace implements INamespace { @Override public INamespace getSiblingNamespace( String name, String type ) { if ( namespace != null ) { try { JsonNode jsonObject = objectMapper.readTree( namespace ); if ( jsonObject.isObject() ) { ObjectNode object = (ObjectNode) jsonObject; object.put( DictionaryConst.PROPERTY_NAME, name ); object.put( DictionaryConst.PROPERTY_TYPE, type ); } return new Namespace( objectMapper.writeValueAsString( jsonObject ) ); } catch ( Exception e ) { return null; } } return null; } Namespace( String namespace ); @Override String getNamespaceId(); @Override INamespace getParentNamespace(); @Override INamespace getSiblingNamespace( String name, String type );  }### Answer:
@Test public void testGetSiblingNamespace() throws Exception { Namespace ns = new Namespace( "{\"namespace\":{\"name\":\"FILE_SYSTEM_REPO\",\"type\":\"Locator\"}," + "\"name\":\"TEST\",\"type\":\"DUMMY\"}" ); assertEquals( "{\"namespace\":{\"name\":\"FILE_SYSTEM_REPO\",\"type\":\"Locator\"}," + "\"name\":\"brother\",\"type\":\"newType\"}", ns.getSiblingNamespace( "brother", "newType" ).getNamespaceId() ); }
@Test public void testGetSiblingNamespace_nullNamespace() throws Exception { Namespace ns = new Namespace( null ); assertNull( ns.getSiblingNamespace( "any", "any" ) ); }
@Test public void testGetSiblingNamespace_invalidJSON() throws Exception { Namespace ns = new Namespace( "{namespace\"={\"name\":\"FILE_SYSTEM_REPO\",\"type\":\"Locator\"}," + "\"name\":\"TEST\",\"type\":\"DUMMY\"}" ); assertNull( ns.getSiblingNamespace( "any", "any" ) ); }