@Test(expectedExceptions = IllegalArgumentException.class) public void testNullStatusType() { new PromotionStatusBuilder(null).build(); }
public PromotionStatus build() { if (status == null) { throw new IllegalArgumentException("Status must have a type."); } if (timestamp == null) { throw new IllegalArgumentException("Status must have a timestamp."); } return new PromotionStatus(status, comment, repository, timestamp, user, ciUser); }
PromotionStatusBuilder { public PromotionStatus build() { if (status == null) { throw new IllegalArgumentException("Status must have a type."); } if (timestamp == null) { throw new IllegalArgumentException("Status must have a timestamp."); } return new PromotionStatus(status, comment, repository, timestamp, user, ciUser); } }
PromotionStatusBuilder { public PromotionStatus build() { if (status == null) { throw new IllegalArgumentException("Status must have a type."); } if (timestamp == null) { throw new IllegalArgumentException("Status must have a timestamp."); } return new PromotionStatus(status, comment, repository, timestamp, user, ciUser); } PromotionStatusBuilder(String status); }
PromotionStatusBuilder { public PromotionStatus build() { if (status == null) { throw new IllegalArgumentException("Status must have a type."); } if (timestamp == null) { throw new IllegalArgumentException("Status must have a timestamp."); } return new PromotionStatus(status, comment, repository, timestamp, user, ciUser); } PromotionStatusBuilder(String status); PromotionStatusBuilder comment(String comment); PromotionStatusBuilder repository(String repository); PromotionStatusBuilder timestamp(String timestamp); PromotionStatusBuilder timestampDate(Date timestampDate); PromotionStatusBuilder user(String user); PromotionStatusBuilder ciUser(String ciUser); PromotionStatus build(); }
PromotionStatusBuilder { public PromotionStatus build() { if (status == null) { throw new IllegalArgumentException("Status must have a type."); } if (timestamp == null) { throw new IllegalArgumentException("Status must have a timestamp."); } return new PromotionStatus(status, comment, repository, timestamp, user, ciUser); } PromotionStatusBuilder(String status); PromotionStatusBuilder comment(String comment); PromotionStatusBuilder repository(String repository); PromotionStatusBuilder timestamp(String timestamp); PromotionStatusBuilder timestampDate(Date timestampDate); PromotionStatusBuilder user(String user); PromotionStatusBuilder ciUser(String ciUser); PromotionStatus build();  }