### Question:
Location { static Location of(String prefixAndName) { int indexOfFirstColon = prefixAndName.indexOf(":"); if (indexOfFirstColon < 0) { return new Location(LocationType.CLASSPATH, prefixAndName); } if (prefixAndName.length() < 3) { throw new MigrationsException("Invalid resource name: '" + prefixAndName + "'"); } String prefix = prefixAndName.substring(0, indexOfFirstColon).toLowerCase(Locale.ENGLISH).trim(); String name = prefixAndName.substring(indexOfFirstColon + 1).trim(); if (name.length() == 0) { throw new MigrationsException("Invalid name."); } switch (prefix) { case MigrationsConfig.PREFIX_CLASSPATH: return new Location(LocationType.CLASSPATH, name); case MigrationsConfig.PREFIX_FILESYSTEM: return new Location(LocationType.FILESYSTEM, name); default: throw new MigrationsException(("Invalid resource prefix: '" + prefix + "'")); } } private  Location(LocationType type, String name); LocationType getType(); String getName();  }### Answer:
@Test void withInvalidName() { assertThatExceptionOfType(MigrationsException.class).isThrownBy(() -> Location.of(":")) .withMessage("Invalid resource name: ':'"); assertThatExceptionOfType(MigrationsException.class).isThrownBy(() -> Location.of(":c")) .withMessage("Invalid resource name: ':c'"); assertThatExceptionOfType(MigrationsException.class).isThrownBy(() -> Location.of("c:")) .withMessage("Invalid resource name: 'c:'"); assertThatExceptionOfType(MigrationsException.class).isThrownBy(() -> Location.of("classpath:")) .withMessage("Invalid name."); }
@Test void withInvalidPrefix() { assertThatExceptionOfType(MigrationsException.class).isThrownBy(() -> Location.of("some:thing")) .withMessage("Invalid resource prefix: 'some'"); }