Skip to content

Commit c268bb0

Browse files
authored
make JobConfiguration.Type enum public (#1736)
* add UTs * style fix
1 parent 56d55a5 commit c268bb0

5 files changed

Lines changed: 24 additions & 5 deletions

File tree

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public abstract class JobConfiguration implements Serializable {
3636
/**
3737
* Type of a BigQuery Job.
3838
*/
39-
enum Type {
39+
public enum Type {
4040
/**
4141
* A Copy Job copies an existing table to another new or existing table. Instances of
4242
* {@code JobConfiguration} for this type are implemented by {@link CopyJobConfiguration}.

google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/CopyJobConfigurationTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ public void testSetProjectId() {
118118
}
119119
}
120120

121+
@Test
122+
public void testGetType() {
123+
assertEquals(JobConfiguration.Type.COPY, COPY_JOB_CONFIGURATION.getType());
124+
assertEquals(JobConfiguration.Type.COPY, COPY_JOB_CONFIGURATION_MULTIPLE_TABLES.getType());
125+
}
126+
121127
private void compareCopyJobConfiguration(CopyJobConfiguration expected,
122128
CopyJobConfiguration value) {
123129
assertEquals(expected, value);

google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ExtractJobConfigurationTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ public void testSetProjectId() {
125125
assertEquals("p", configuration.getSourceTable().getProject());
126126
}
127127

128+
@Test
129+
public void testGetType() {
130+
assertEquals(JobConfiguration.Type.EXTRACT, EXTRACT_CONFIGURATION.getType());
131+
assertEquals(JobConfiguration.Type.EXTRACT, EXTRACT_CONFIGURATION_ONE_URI.getType());
132+
}
133+
128134
private void compareExtractJobConfiguration(ExtractJobConfiguration expected,
129135
ExtractJobConfiguration value) {
130136
assertEquals(expected, value);

google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/LoadJobConfigurationTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ public void testSetProjectId() {
109109
assertEquals("p", configuration.getDestinationTable().getProject());
110110
}
111111

112+
@Test
113+
public void testGetType() {
114+
assertEquals(JobConfiguration.Type.LOAD, LOAD_CONFIGURATION.getType());
115+
}
116+
112117
private void compareLoadJobConfiguration(LoadJobConfiguration expected,
113118
LoadJobConfiguration value) {
114119
assertEquals(expected, value);

google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/QueryJobConfigurationTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,15 @@
1919
import static org.junit.Assert.assertEquals;
2020
import static org.junit.Assert.assertNotNull;
2121
import static org.junit.Assert.assertNull;
22-
import static org.junit.Assert.assertTrue;
2322

2423
import com.google.cloud.bigquery.JobInfo.CreateDisposition;
2524
import com.google.cloud.bigquery.JobInfo.WriteDisposition;
2625
import com.google.cloud.bigquery.QueryJobConfiguration.Priority;
2726
import com.google.common.collect.ImmutableList;
2827
import com.google.common.collect.ImmutableMap;
29-
30-
import org.junit.Test;
31-
3228
import java.util.List;
3329
import java.util.Map;
30+
import org.junit.Test;
3431

3532
public class QueryJobConfigurationTest {
3633

@@ -134,6 +131,11 @@ public void testSetProjectId() {
134131
assertEquals("p", configuration.getDestinationTable().getProject());
135132
}
136133

134+
@Test
135+
public void testGetType() {
136+
assertEquals(JobConfiguration.Type.QUERY, QUERY_JOB_CONFIGURATION.getType());
137+
}
138+
137139
private void compareQueryJobConfiguration(QueryJobConfiguration expected,
138140
QueryJobConfiguration value) {
139141
assertEquals(expected, value);

0 commit comments

Comments
 (0)