CircuitBreakerBeanFactory extends CircuitBreakerFactory implements InitializingBean { public synchronized CircuitBreaker createCircuitBreaker(String name, CircuitBreakerConfig config) { CircuitBreaker circuitBreaker = findCircuitBreaker(name); if (circuitBreaker == null) { circuitBreaker = new CircuitBreakerBean(name); configureCircuitBreaker(name, circuitBreaker, config); if (mBeanExportOperations != null) { ObjectName objectName; try { objectName = new ObjectName("org.fishwife.jrugged.spring:type=CircuitBreakerBean," + "name=" + name); } catch (MalformedObjectNameException e) { throw new IllegalArgumentException("Invalid MBean Name " + name, e); } mBeanExportOperations.registerManagedResource(circuitBreaker, objectName); } addCircuitBreakerToMap(name, circuitBreaker); } return circuitBreaker; }  void afterPropertiesSet(); @Deprecated void setMBeanExporter(MBeanExporter mBeanExporter); void setMBeanExportOperations(MBeanExportOperations mBeanExportOperations); void setPackageScanBase(String packageScanBase); void buildAnnotatedCircuitBreakers(); synchronized CircuitBreaker createCircuitBreaker(String name, CircuitBreakerConfig config); CircuitBreakerBean findCircuitBreakerBean(String name);  }
@Test public void testCreateCircuitBreaker() { CircuitBreaker createdBreaker = factory.createCircuitBreaker("testCreate", config); assertNotNull(createdBreaker); }
@Test public void testCreateDuplicateCircuitBreaker() { String name = "testCreate"; CircuitBreaker createdBreaker = factory.createCircuitBreaker(name, config); CircuitBreaker secondBreaker = factory.createCircuitBreaker(name, config); assertSame(createdBreaker, secondBreaker); }