@Test public void testInvalidNames() { ContainerNameValidator validator = new ContainerNameValidator(); try { validator.validate("adasd-ab--baba"); throw new RuntimeException("to be converted to TestException later"); } catch (IllegalArgumentException e) { } try { validator.validate("abc.zz.la"); throw new RuntimeException("to be converted to TestException later"); } catch (IllegalArgumentException e) { } try { validator.validate("abcZZla"); throw new RuntimeException("to be converted to TestException later"); } catch (IllegalArgumentException e) { } try { validator.validate("zz"); throw new RuntimeException("to be converted to TestException later"); } catch (IllegalArgumentException e) { } try { validator.validate("a????"); throw new RuntimeException("to be converted to TestException later"); } catch (IllegalArgumentException e) { } try { validator.validate("-adasd"); throw new RuntimeException("to be converted to TestException later"); } catch (IllegalArgumentException e) { } try { validator.validate("adasd-"); throw new RuntimeException("to be converted to TestException later"); } catch (IllegalArgumentException e) { } }
public void validate(String containerName) { super.validate(containerName); if (containerName.contains("--")) throw exception(containerName, "Every dash must be followed by letter or number"); if (containerName.endsWith("-")) throw exception(containerName, "Shouldn't end with a dash"); }
ContainerNameValidator extends DnsNameValidator { public void validate(String containerName) { super.validate(containerName); if (containerName.contains("--")) throw exception(containerName, "Every dash must be followed by letter or number"); if (containerName.endsWith("-")) throw exception(containerName, "Shouldn't end with a dash"); } }
ContainerNameValidator extends DnsNameValidator { public void validate(String containerName) { super.validate(containerName); if (containerName.contains("--")) throw exception(containerName, "Every dash must be followed by letter or number"); if (containerName.endsWith("-")) throw exception(containerName, "Shouldn't end with a dash"); } @Inject  ContainerNameValidator(); }
ContainerNameValidator extends DnsNameValidator { public void validate(String containerName) { super.validate(containerName); if (containerName.contains("--")) throw exception(containerName, "Every dash must be followed by letter or number"); if (containerName.endsWith("-")) throw exception(containerName, "Shouldn't end with a dash"); } @Inject  ContainerNameValidator(); void validate(String containerName); }
ContainerNameValidator extends DnsNameValidator { public void validate(String containerName) { super.validate(containerName); if (containerName.contains("--")) throw exception(containerName, "Every dash must be followed by letter or number"); if (containerName.endsWith("-")) throw exception(containerName, "Shouldn't end with a dash"); } @Inject  ContainerNameValidator(); void validate(String containerName);  }