@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void loadResourceConfigurationWithName() throws Exception {
//tell the method story as it happens: mock or create dependencies and configure
//those dependencies to get the method under test to completion.
ResourceContext mockResourceContext = mock(ResourceContext.class);
ResourceType mockResourceType = mock(ResourceType.class);
when(mockResourceContext.getResourceType()).thenReturn(mockResourceType);
ConfigurationDefinition mockConfigurationDefinition = mock(ConfigurationDefinition.class);
when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);
ConfigurationTemplate mockConfigurationTemplate = mock(ConfigurationTemplate.class);
when(mockConfigurationDefinition.getDefaultTemplate()).thenReturn(mockConfigurationTemplate);
Configuration mockConfiguration = mock(Configuration.class);
when(mockConfigurationTemplate.getConfiguration()).thenReturn(mockConfiguration);
Property mockProperty = mock(Property.class);
when(mockConfiguration.get("_type")).thenReturn(null);
when(mockConfiguration.get(eq("__name"))).thenReturn(mockProperty);
Map<String, PropertyDefinition> mockMap = (Map<String, PropertyDefinition>) mock(Map.class);
when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);
ConfigurationLoadDelegate mockConfigurationLoadDelegate = mock(ConfigurationLoadDelegate.class);
PowerMockito.whenNew(ConfigurationLoadDelegate.class)
.withParameterTypes(ConfigurationDefinition.class, ASConnection.class, Address.class)
.withArguments(any(ConfigurationDefinition.class), any(ASConnection.class), any(Address.class))
.thenReturn(mockConfigurationLoadDelegate);
when(mockConfigurationLoadDelegate.loadResourceConfiguration()).thenReturn(mockConfiguration);
PropertySimple pathPropertySimple = new PropertySimple("path", "abc=def,xyz=test1");
when(mockConfiguration.get(eq("path"))).thenReturn(pathPropertySimple);
when(mockResourceContext.getPluginConfiguration()).thenReturn(mockConfiguration);
ASConnection mockASConnection = mock(ASConnection.class);
PropertySimple namePropertySimple = new PropertySimple("__name", "test1");
PowerMockito.whenNew(PropertySimple.class).withParameterTypes(String.class, Object.class)