@Test public void shouldThrowExceptionIfPricePerDosageIsNegativeOnValidation() throws Exception { ProgramProduct programProduct = mock(ProgramProduct.class); doNothing().when(programProduct).validate(); ProgramProductPrice programProductPrice = new ProgramProductPrice(programProduct, new Money("-1"), "source"); expectException.expect(DataException.class); expectException.expectMessage("programProductPrice.invalid.price.per.dosage"); programProductPrice.validate(); }
public void validate() { programProduct.validate(); if (pricePerDosage.isNegative()) throw new DataException("programProductPrice.invalid.price.per.dosage"); }
ProgramProductPrice extends BaseModel implements Importable { public void validate() { programProduct.validate(); if (pricePerDosage.isNegative()) throw new DataException("programProductPrice.invalid.price.per.dosage"); } }
ProgramProductPrice extends BaseModel implements Importable { public void validate() { programProduct.validate(); if (pricePerDosage.isNegative()) throw new DataException("programProductPrice.invalid.price.per.dosage"); } ProgramProductPrice(ProgramProduct programProduct, Money pricePerDosage, String source); }
ProgramProductPrice extends BaseModel implements Importable { public void validate() { programProduct.validate(); if (pricePerDosage.isNegative()) throw new DataException("programProductPrice.invalid.price.per.dosage"); } ProgramProductPrice(ProgramProduct programProduct, Money pricePerDosage, String source); void validate(); }
ProgramProductPrice extends BaseModel implements Importable { public void validate() { programProduct.validate(); if (pricePerDosage.isNegative()) throw new DataException("programProductPrice.invalid.price.per.dosage"); } ProgramProductPrice(ProgramProduct programProduct, Money pricePerDosage, String source); void validate();  }