-
Notifications
You must be signed in to change notification settings - Fork 25
feat: Added Zion's Movie Object and Test to lesson_16 #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cfdb19d
feat: Added Zion's Bedroom Object and Test to lesson_16
zionbuch 763424d
fix: naming errors
zionbuch ac65838
Merge branch 'code-differently:main' into lesson_16
zionbuch 5b31569
feat: added Zion's Movie Object and Test to lesson_16 hw
zionbuch 43c7166
Merge branch 'lesson_16' of https://github.com/zionbuch/code-differen…
zionbuch 36dff74
Merge branch 'code-differently:main' into lesson_16
zionbuch fd8880c
feix: Mresolved changes
zionbuch d0c7838
feat: made changes to Zions Movie Folder for lesson_16
zionbuch d70085b
Merge branch 'code-differently:main' into lesson_16
zionbuch ca0b09d
Merge branch 'code-differently:main' into lesson_16
zionbuch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/movie/Genres.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.codedifferently.lesson16.movie; | ||
|
||
public enum Genres { | ||
DRAMA, | ||
COMEDY, | ||
ACTION, | ||
THRILLER, | ||
HORROR, | ||
SCIENCE_FICTION, | ||
FANTASY, | ||
ROMANCE, | ||
ADVENTURE, | ||
MYSTERY; | ||
} |
63 changes: 63 additions & 0 deletions
63
lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/movie/Movie.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.codedifferently.lesson16.movie; | ||
|
||
public class Movie { | ||
|
||
// member variables | ||
private String title; | ||
private int releaseYear; | ||
private double rating; | ||
private final Genres genres; | ||
private final MovieRating movieRating; | ||
|
||
// constructor | ||
public Movie( | ||
String title, int releaseYear, double rating, MovieRating movieRating, Genres genres) { | ||
this.title = title; | ||
this.releaseYear = releaseYear; | ||
this.rating = rating; | ||
this.movieRating = movieRating; | ||
this.genres = genres; | ||
} | ||
|
||
// getters and setters member functions | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public int getReleaseYear() { | ||
return releaseYear; | ||
} | ||
|
||
public int setReleaseYear(int releaseYear) { | ||
return this.releaseYear = releaseYear; | ||
} | ||
|
||
public double getRating() { | ||
return rating; | ||
} | ||
|
||
public double setRating(double rating) { | ||
return this.rating = rating; | ||
} | ||
|
||
public Genres getGenres() { | ||
return genres; | ||
} | ||
|
||
public MovieRating getMovieRating() { | ||
return movieRating; | ||
} | ||
|
||
public String getMovieTitle() { | ||
return title; | ||
} | ||
|
||
public String setMovieTitle() { | ||
zionbuch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return "Creed 2"; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
..._16/objects/objects_app/src/main/java/com/codedifferently/lesson16/movie/MovieRating.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.codedifferently.lesson16.movie; | ||
|
||
public enum MovieRating { | ||
zionbuch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
G, | ||
PG, | ||
PG_13, | ||
R; | ||
} |
8 changes: 8 additions & 0 deletions
8
..._16/objects/objects_app/src/main/java/com/codedifferently/lesson16/movie/releaseYear.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
|
||
package com.codedifferently.lesson16.movie; | ||
|
||
class releaseYear {} | ||
zionbuch marked this conversation as resolved.
Show resolved
Hide resolved
|
55 changes: 55 additions & 0 deletions
55
...on_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/movie/MovieTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.codedifferently.lesson16.movie; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class MovieTest { | ||
Movie movie; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
movie = new Movie("Creed", 2015, 7.6, MovieRating.PG_13, Genres.ACTION); | ||
} | ||
|
||
@Test | ||
void testGetMovieTitle() { | ||
// act | ||
String title = movie.getMovieTitle(); | ||
// assert | ||
assertEquals("Creed", title); | ||
} | ||
|
||
@Test | ||
void testSetMovieTitle() { | ||
// arrange | ||
// act | ||
String title = movie.setMovieTitle(); | ||
// assert | ||
assertEquals("Creed 2", title); | ||
} | ||
|
||
@Test | ||
void testGetReleaseYear() { | ||
int releaseYear = movie.getReleaseYear(); | ||
assertEquals(2015, 2015); | ||
} | ||
|
||
@Test | ||
void testSetReleaseYear() { | ||
int releaseYear = movie.setReleaseYear(2018); | ||
assertEquals(movie.getReleaseYear(), 2018); | ||
} | ||
|
||
@Test | ||
void testGetRating() { | ||
double rating = movie.getRating(); | ||
assertEquals(movie.getRating(), 7.6); | ||
} | ||
|
||
@Test | ||
void testGetGenres() { | ||
assertEquals(Genres.ACTION, movie.getGenres()); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.