XComp commented on a change in pull request #16286:
URL: https://github.com/apache/flink/pull/16286#discussion_r662059148



##########
File path: 
flink-clients/src/test/java/org/apache/flink/client/deployment/application/FromJarEntryClassInformationProviderTest.java
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.flink.client.deployment.application;
+
+import org.apache.flink.client.program.PackagedProgramUtils;
+import org.apache.flink.configuration.ConfigConstants;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Assume;
+import org.junit.Test;
+
+import java.io.File;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+/**
+ * {@code FromJarEntryClassInformationProviderTest} tests {@link
+ * FromJarEntryClassInformationProvider}.
+ */
+public class FromJarEntryClassInformationProviderTest extends TestLogger {
+
+    @Test
+    public void testCustomJarFile() {
+        final File jarFile = new File("some/path/to/jar");
+        final String jobClassName = "JobClassName";
+        final FromJarEntryClassInformationProvider testInstance =
+                
FromJarEntryClassInformationProvider.createFromCustomJar(jarFile, jobClassName);
+
+        assertThat(testInstance.getJarFile().isPresent(), is(true));
+        assertThat(testInstance.getJarFile().get(), is(jarFile));
+        assertThat(testInstance.getJobClassName().isPresent(), is(true));
+        assertThat(testInstance.getJobClassName().get(), is(jobClassName));
+    }
+
+    @Test
+    public void testMissingJar() {
+        final String jobClassName = "JobClassName";
+        final EntryClassInformationProvider testInstance =
+                FromJarEntryClassInformationProvider.createFromCustomJar(null, 
jobClassName);
+        assertThat(testInstance.getJarFile().isPresent(), is(false));
+        assertThat(testInstance.getJobClassName().isPresent(), is(true));
+        assertThat(testInstance.getJobClassName().get(), is(jobClassName));
+    }
+
+    @Test
+    public void testMissingJobClassName() {
+        final File jarFile = new File("some/path/to/jar");
+        final EntryClassInformationProvider testInstance =
+                
FromJarEntryClassInformationProvider.createFromCustomJar(jarFile, null);
+        assertThat(testInstance.getJarFile().isPresent(), is(true));
+        assertThat(testInstance.getJarFile().get(), is(jarFile));
+        assertThat(testInstance.getJobClassName().isPresent(), is(false));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testEitherJobClassNameOrJarHasToBeSet() {
+        FromJarEntryClassInformationProvider.createFromCustomJar(null, null);
+    }
+
+    @Test
+    public void testPythonJarFile() {

Review comment:
       I guess, you're right. It was just that I thought it's an obvious test 
and just later on realized that it's not that easy to fix. Reconsidering this, 
I have to admit that my approach is not the right one. I'm gonna revert the 
tests and comment on `FLINK-23154` accordingly.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to