rage / java-programming

https://java-programming.mooc.fi
494 stars 209 forks source link

Part 10 Programming exercise: Show and ticket. Error in class diagram? #144

Open ZdravekSprite opened 4 years ago

ZdravekSprite commented 4 years ago

class diagram is: [Show]<-*[Ticket] [Show|- movie: String;- time: String] [Ticket|- seat: int;- code: int] there should be: [Show]<show-[Ticket] [Show|- movie: String;- time: String] [Ticket|- seat: int;- code: int]

muzimuzhi commented 3 years ago

Agree with you. Perhaps "[Show]<-[Ticket]" is enough because only the existence of reference is checked in corresponding test class ShowAndTicketTest.java.

Also in the test class, I think the second usages of method limitAttributeCount should be called with ("Ticket", 3), rather than ("Show", 3).

    @Test
    public void ClassesExist() {
        PrivateAttributesExist("Show", "movie", String.class);
        PrivateAttributesExist("Show", "time", String.class);
        limitAttributeCount("Show", 2);

        PrivateAttributesExist("Ticket", "seat", int.class);
        PrivateAttributesExist("Ticket", "code", int.class);
        limitAttributeCount("Show", 3);  // the first argument should be "Ticket"

        referenceExists("Ticket", "Show");
    }