@Test(expected = IllegalStateException.class) public void testSetReleaseDate() { Movie m = new Movie(); Date d = new Date(Calendar.getInstance().getTimeInMillis()); m.setReleaseDate(d); assertEquals(d, m.getReleaseDate()); m.setReleaseDate(null); }
public void setReleaseDate(Date aReleaseDate) { if (this.releaseDate != null) { throw new IllegalStateException(); } this.releaseDate = aReleaseDate; }
Movie { public void setReleaseDate(Date aReleaseDate) { if (this.releaseDate != null) { throw new IllegalStateException(); } this.releaseDate = aReleaseDate; } }
Movie { public void setReleaseDate(Date aReleaseDate) { if (this.releaseDate != null) { throw new IllegalStateException(); } this.releaseDate = aReleaseDate; } protected  Movie();  Movie(String aTitle, PriceCategory aPriceCategory);  Movie(String aTitle, Date aReleaseDate, PriceCategory aPriceCategory); }
Movie { public void setReleaseDate(Date aReleaseDate) { if (this.releaseDate != null) { throw new IllegalStateException(); } this.releaseDate = aReleaseDate; } protected  Movie();  Movie(String aTitle, PriceCategory aPriceCategory);  Movie(String aTitle, Date aReleaseDate, PriceCategory aPriceCategory); PriceCategory getPriceCategory(); void setPriceCategory(PriceCategory aPriceCategory); String getTitle(); void setTitle(String aTitle); Date getReleaseDate(); void setReleaseDate(Date aReleaseDate); boolean isRented(); void setRented(boolean isRented); int getId(); void setId(int anId); @Override int hashCode(); @Override boolean equals(Object obj); }
Movie { public void setReleaseDate(Date aReleaseDate) { if (this.releaseDate != null) { throw new IllegalStateException(); } this.releaseDate = aReleaseDate; } protected  Movie();  Movie(String aTitle, PriceCategory aPriceCategory);  Movie(String aTitle, Date aReleaseDate, PriceCategory aPriceCategory); PriceCategory getPriceCategory(); void setPriceCategory(PriceCategory aPriceCategory); String getTitle(); void setTitle(String aTitle); Date getReleaseDate(); void setReleaseDate(Date aReleaseDate); boolean isRented(); void setRented(boolean isRented); int getId(); void setId(int anId); @Override int hashCode(); @Override boolean equals(Object obj);  }