S3Loader { String bucketId(String envName, String bucketName) { if (!bucketName.startsWith(envName + "-")) return null; if (bucketName.length() <= envName.length() + 1) return null; return bucketName.substring(envName.length() + 1); } S3Loader(Resources resources, Environment env); void load();  }
@Test void validEnvBuckets() { assertEquals("test", loader.bucketId(ENV, "env-test")); }
@Test void invalidEnvBuckets() { assertNull(loader.bucketId(ENV, "test")); assertNull(loader.bucketId(ENV, "en")); assertNull(loader.bucketId(ENV, "env-")); }