Skip to content

Commit

Permalink
static imports of lombok generated methods doesn't work with javac
Browse files Browse the repository at this point in the history
  • Loading branch information
c-eg committed Jun 26, 2024
1 parent 7595ba6 commit 279dc3a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
9 changes: 4 additions & 5 deletions src/test/java/info/movito/themoviedbapi/TmdbAccountTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import info.movito.themoviedbapi.util.Utils;
import org.junit.jupiter.api.Test;

import static info.movito.themoviedbapi.AbstractTmdbApi.getObjectMapper;
import static info.movito.themoviedbapi.TmdbAccount.TMDB_METHOD_ACCOUNT;
import static info.movito.themoviedbapi.tools.ApiUrl.TMDB_API_BASE_URL;
import static info.movito.themoviedbapi.util.TestUtils.validateAbstractJsonMappingFields;
Expand Down Expand Up @@ -65,7 +64,7 @@ public void testAddFavourite() throws TmdbException, IOException {
requestBody.put("media_type", mediaType.toString());
requestBody.put("media_id", mediaId);
requestBody.put("favorite", true);
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

String body = TestUtils.readTestFile("api_responses/account/add_favourite.json");
when(getTmdbUrlReader().readUrl(url, jsonBody, RequestType.POST)).thenReturn(body);
Expand All @@ -91,7 +90,7 @@ public void testRemoveFavorite() throws TmdbException, IOException {
requestBody.put("media_type", mediaType.toString());
requestBody.put("media_id", mediaId);
requestBody.put("favorite", false);
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

String body = TestUtils.readTestFile("api_responses/account/add_favourite.json");
when(getTmdbUrlReader().readUrl(url, jsonBody, RequestType.POST)).thenReturn(body);
Expand All @@ -117,7 +116,7 @@ public void testAddToWatchList() throws IOException, TmdbException {
requestBody.put("media_type", mediaType.toString());
requestBody.put("media_id", mediaId);
requestBody.put("watchlist", true);
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

String body = TestUtils.readTestFile("api_responses/account/add_to_watchlist.json");
when(getTmdbUrlReader().readUrl(url, jsonBody, RequestType.POST)).thenReturn(body);
Expand All @@ -143,7 +142,7 @@ public void testRemoveFromWatchList() throws IOException, TmdbException {
requestBody.put("media_type", mediaType.toString());
requestBody.put("media_id", mediaId);
requestBody.put("watchlist", false);
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

String body = TestUtils.readTestFile("api_responses/account/add_to_watchlist.json");
when(getTmdbUrlReader().readUrl(url, jsonBody, RequestType.POST)).thenReturn(body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import info.movito.themoviedbapi.util.Utils;
import org.junit.jupiter.api.Test;

import static info.movito.themoviedbapi.AbstractTmdbApi.getObjectMapper;
import static info.movito.themoviedbapi.TmdbAuthentication.TMDB_METHOD_AUTH;
import static info.movito.themoviedbapi.tools.ApiUrl.TMDB_API_BASE_URL;
import static info.movito.themoviedbapi.tools.TmdbResponseCode.INVALID_API_KEY;
Expand Down Expand Up @@ -104,7 +103,7 @@ public void testCreateSession() throws TmdbException, IOException {

HashMap<String, Object> requestBody = new HashMap<>();
requestBody.put("request_token", requestTokenStr);
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

String url = TMDB_API_BASE_URL + TMDB_METHOD_AUTH + "/session/new";
String body = TestUtils.readTestFile("api_responses/authentication/create_session.json");
Expand Down Expand Up @@ -141,7 +140,7 @@ public void testCreateAuthenticatedRequestToken() throws TmdbException, IOExcept
requestBody.put("username", "username");
requestBody.put("password", "password");
requestBody.put("request_token", requestToken.getRequestToken());
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

String url = TMDB_API_BASE_URL + TMDB_METHOD_AUTH + "/token/validate_with_login";
String body = TestUtils.readTestFile("api_responses/authentication/create_session_with_login.json");
Expand Down Expand Up @@ -171,7 +170,7 @@ public void testCreateSessionWithLoginUnsuccessfulRequestToken() {
public void testDeleteSession() throws TmdbException, IOException {
HashMap<String, Object> requestBody = new HashMap<>();
requestBody.put("session_id", "sessionId");
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

String url = TMDB_API_BASE_URL + TMDB_METHOD_AUTH + "/session";
String body = TestUtils.readTestFile("api_responses/authentication/delete_session.json");
Expand Down
7 changes: 3 additions & 4 deletions src/test/java/info/movito/themoviedbapi/TmdbListsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import info.movito.themoviedbapi.util.Utils;
import org.junit.jupiter.api.Test;

import static info.movito.themoviedbapi.AbstractTmdbApi.getObjectMapper;
import static info.movito.themoviedbapi.TmdbLists.TMDB_METHOD_LIST;
import static info.movito.themoviedbapi.tools.ApiUrl.TMDB_API_BASE_URL;
import static info.movito.themoviedbapi.util.TestUtils.validateAbstractJsonMappingFields;
Expand All @@ -41,7 +40,7 @@ public void testAddMovie() throws IOException, TmdbException {

HashMap<String, Object> requestBody = new HashMap<>();
requestBody.put("media_id", 456);
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

when(getTmdbUrlReader().readUrl(url, jsonBody, RequestType.POST)).thenReturn(body);

Expand Down Expand Up @@ -92,7 +91,7 @@ public void testCreate() throws IOException, TmdbException {
requestBody.put("name", "testName");
requestBody.put("description", "testDescription");
requestBody.put("language", "en-US");
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

when(getTmdbUrlReader().readUrl(url, jsonBody, RequestType.POST)).thenReturn(body);

Expand Down Expand Up @@ -140,7 +139,7 @@ public void testRemoveMovie() throws IOException, TmdbException {

HashMap<String, Object> requestBody = new HashMap<>();
requestBody.put("media_id", 456);
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

when(getTmdbUrlReader().readUrl(url, jsonBody, RequestType.POST)).thenReturn(body);

Expand Down
3 changes: 1 addition & 2 deletions src/test/java/info/movito/themoviedbapi/TmdbMoviesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import info.movito.themoviedbapi.util.Utils;
import org.junit.jupiter.api.Test;

import static info.movito.themoviedbapi.AbstractTmdbApi.getObjectMapper;
import static info.movito.themoviedbapi.TmdbMovies.TMDB_METHOD_MOVIE;
import static info.movito.themoviedbapi.tools.ApiUrl.TMDB_API_BASE_URL;
import static info.movito.themoviedbapi.util.TestUtils.validateAbstractJsonMappingFields;
Expand Down Expand Up @@ -356,7 +355,7 @@ public void testGetWatchProviders() throws IOException, TmdbException {
public void testAddRating() throws IOException, TmdbException {
HashMap<String, Object> requestBody = new HashMap<>();
requestBody.put("value", 2.1);
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

String url = TMDB_API_BASE_URL + TMDB_METHOD_MOVIE + "/123/rating";
String body = TestUtils.readTestFile("api_responses/movies/add_rating.json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import info.movito.themoviedbapi.util.Utils;
import org.junit.jupiter.api.Test;

import static info.movito.themoviedbapi.AbstractTmdbApi.getObjectMapper;
import static info.movito.themoviedbapi.TmdbTvEpisodes.TMDB_METHOD_TV_EPISODE;
import static info.movito.themoviedbapi.TmdbTvSeasons.TMDB_METHOD_TV_SEASON;
import static info.movito.themoviedbapi.TmdbTvSeries.TMDB_METHOD_TV;
Expand Down Expand Up @@ -200,7 +199,7 @@ public void testGetVideos() throws IOException, TmdbException {
public void testAddRating() throws IOException, TmdbException {
HashMap<String, Object> requestBody = new HashMap<>();
requestBody.put("value", 2.1);
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

String url = TMDB_API_BASE_URL + TMDB_METHOD_TV + "/123/" + TMDB_METHOD_TV_SEASON + "/1/" + TMDB_METHOD_TV_EPISODE +
"/1/rating";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import info.movito.themoviedbapi.util.Utils;
import org.junit.jupiter.api.Test;

import static info.movito.themoviedbapi.AbstractTmdbApi.getObjectMapper;
import static info.movito.themoviedbapi.TmdbTvSeries.TMDB_METHOD_TV;
import static info.movito.themoviedbapi.tools.ApiUrl.TMDB_API_BASE_URL;
import static info.movito.themoviedbapi.util.TestUtils.validateAbstractJsonMappingFields;
Expand Down Expand Up @@ -407,7 +406,7 @@ public void testGetWatchProviders() throws IOException, TmdbException {
public void testAddRating() throws IOException, TmdbException {
HashMap<String, Object> requestBody = new HashMap<>();
requestBody.put("value", 2.1);
String jsonBody = Utils.convertToJson(getObjectMapper(), requestBody);
String jsonBody = Utils.convertToJson(AbstractTmdbApi.getObjectMapper(), requestBody);

String url = TMDB_API_BASE_URL + TMDB_METHOD_TV + "/123/rating";
String body = TestUtils.readTestFile("api_responses/tv_series/add_rating.json");
Expand Down

0 comments on commit 279dc3a

Please sign in to comment.