@Test public void testNegativeCapacity() throws Exception { AttachedDisk disk = AttachedDisk.create("id", "name", "kind", "flavor", -10, true); ImmutableList<String> violations = validator.validate(disk); assertThat(violations.size(), is(1)); assertThat(violations.get(0), containsString("must be greater than or equal to 1")); }
public static AttachedDisk create(String id, String name, String kind, String flavor, int capacityGb, boolean isBootDisk) { AttachedDisk result = new AttachedDisk(); result.setId(id); result.setName(name); result.setKind(kind); result.setFlavor(flavor); result.setCapacityGb(capacityGb); result.setBootDisk(isBootDisk); result.setState(DiskState.CREATING.toString()); return result; }
AttachedDisk extends FlavoredCompact { public static AttachedDisk create(String id, String name, String kind, String flavor, int capacityGb, boolean isBootDisk) { AttachedDisk result = new AttachedDisk(); result.setId(id); result.setName(name); result.setKind(kind); result.setFlavor(flavor); result.setCapacityGb(capacityGb); result.setBootDisk(isBootDisk); result.setState(DiskState.CREATING.toString()); return result; } }
AttachedDisk extends FlavoredCompact { public static AttachedDisk create(String id, String name, String kind, String flavor, int capacityGb, boolean isBootDisk) { AttachedDisk result = new AttachedDisk(); result.setId(id); result.setName(name); result.setKind(kind); result.setFlavor(flavor); result.setCapacityGb(capacityGb); result.setBootDisk(isBootDisk); result.setState(DiskState.CREATING.toString()); return result; }  }
AttachedDisk extends FlavoredCompact { public static AttachedDisk create(String id, String name, String kind, String flavor, int capacityGb, boolean isBootDisk) { AttachedDisk result = new AttachedDisk(); result.setId(id); result.setName(name); result.setKind(kind); result.setFlavor(flavor); result.setCapacityGb(capacityGb); result.setBootDisk(isBootDisk); result.setState(DiskState.CREATING.toString()); return result; }  static AttachedDisk create(String id, String name, String kind, String flavor,
                                    int capacityGb, boolean isBootDisk); int getCapacityGb(); void setCapacityGb(int capacity); boolean isBootDisk(); void setBootDisk(boolean bootDisk); @Override boolean equals(Object o); @Override int hashCode(); }
AttachedDisk extends FlavoredCompact { public static AttachedDisk create(String id, String name, String kind, String flavor, int capacityGb, boolean isBootDisk) { AttachedDisk result = new AttachedDisk(); result.setId(id); result.setName(name); result.setKind(kind); result.setFlavor(flavor); result.setCapacityGb(capacityGb); result.setBootDisk(isBootDisk); result.setState(DiskState.CREATING.toString()); return result; }  static AttachedDisk create(String id, String name, String kind, String flavor,
                                    int capacityGb, boolean isBootDisk); int getCapacityGb(); void setCapacityGb(int capacity); boolean isBootDisk(); void setBootDisk(boolean bootDisk); @Override boolean equals(Object o); @Override int hashCode();  }