[LIB-10] Tests for Requesters
[snooker-score-api.git] / src / test / java / org / hedgecode / snooker / request / SeasonEventsRequesterTest.java
diff --git a/src/test/java/org/hedgecode/snooker/request/SeasonEventsRequesterTest.java b/src/test/java/org/hedgecode/snooker/request/SeasonEventsRequesterTest.java
new file mode 100644 (file)
index 0000000..989bd7a
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2017-2020. Developed by Hedgecode.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.hedgecode.snooker.request;
+
+import org.hedgecode.snooker.api.Season;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link SeasonEventsRequester}.
+ *
+ * @author Dmitry Samoshin aka gotty
+ */
+@RunWith(JUnit4.class)
+public class SeasonEventsRequesterTest extends AbstractRequesterTest {
+
+    @Test
+    public void testGetInstance() throws Exception {
+        assertNotNull(
+                SeasonEventsRequester.getInstance()
+        );
+    }
+
+    @Test
+    @Override
+    public void testIncorrectRequestById() throws Exception {
+        // do not supported
+    }
+
+    @Override
+    protected Requester getRequester() {
+        return SeasonEventsRequester.getInstance();
+    }
+
+    @Override
+    protected RequestParams getCorrectRequestParams() {
+        return new RequestParams(RequestType.SEASON_EVENTS, CORRECT_ID, Season.CURRENT_SEASON);
+    }
+
+    @Override
+    protected RequestParams getIncorrectRequestParams() {
+        return new RequestParams(RequestType.SEASON_EVENTS, INCORRECT_ID, null);
+    }
+
+    @Override
+    protected String getCorrectRequestUrl() {
+        return String.format("%s?t=5&s=%d", REQUEST_URL, Season.CURRENT_YEAR);
+    }
+
+}