### Question:
StackValidator { public void validate(Stack subject, ValidationResult.ValidationResultBuilder validationBuilder) { if (CollectionUtils.isEmpty(subject.getInstanceGroups())) { validationBuilder.error("Stack request must contain instance groups."); } validateTemplates(subject, validationBuilder); validateEncryptionKey(subject, validationBuilder); }  void validate(Stack subject, ValidationResult.ValidationResultBuilder validationBuilder);  }### Answer:
@Test public void testWithZeroRootVolumeSize() { assertNotNull(templateValidator); Stack stackRequest = stackWithRootVolumeSize(0); ValidationResult.ValidationResultBuilder builder = new ValidationResult.ValidationResultBuilder(); underTest.validate(stackRequest, builder); assertEquals(ERROR, builder.build().getState()); }
@Test public void testWithNegativeRootVolumeSize() { Stack stack = stackWithRootVolumeSize(-1); ValidationResult.ValidationResultBuilder builder = new ValidationResult.ValidationResultBuilder(); underTest.validate(stack, builder); assertEquals(ERROR, builder.build().getState()); }
@Test public void testNullValueIsAllowedForRootVolumeSize() { Stack stack = stackWithRootVolumeSize(null); ValidationResult.ValidationResultBuilder builder = new ValidationResult.ValidationResultBuilder(); underTest.validate(stack, builder); assertEquals(VALID, builder.build().getState()); }
@Test public void testWithPositiveRootVolumeSize() { Stack stack = stackWithRootVolumeSize(1); ValidationResult.ValidationResultBuilder builder = new ValidationResult.ValidationResultBuilder(); underTest.validate(stack, builder); assertEquals(VALID, builder.build().getState()); }