PrivateEc2Template { public AWSEC2Volume getEC2Volume(final String volumeName) { return this.getResourceType(AWSEC2Volume.class, volumeName); }  void setResources(final List<AWSResource> resources); List<AWSResource> getResources(); AWSEC2Instance getEC2Instance(); AWSEC2Volume getEC2Volume(final String volumeName); @Override String toString();  }
@Test public void testGetEC2Volume() throws Exception { template.setResources(new ArrayList<AWSResource>()); AWSEC2Volume vol1 = new AWSEC2Volume(); vol1.setResourceName("volume1"); template.getResources().add(vol1); AWSEC2Volume vol2 = new AWSEC2Volume(); vol2.setResourceName("volume2"); template.getResources().add(vol2); Assert.assertNotNull(template.getEC2Volume("volume2")); Assert.assertNotNull(template.getEC2Volume("volume1")); Assert.assertNull(template.getEC2Volume("volume3")); Assert.assertNotNull(template.getEC2Volume(null)); }