@@ -117,6 +117,42 @@ public void testFetchTableSchema_ActualValueType() throws Exception {
117117 schema .getField ("user_name" ).getSchema ().getUnionSchemas ().get (0 ).getType ());
118118 }
119119
120+ @ Test
121+ public void testFetchTableSchema_GlideTimeFieldWithActualValueType () throws Exception {
122+ ServiceNowConnectorConfig mockConfig = Mockito .mock (ServiceNowConnectorConfig .class );
123+ ServiceNowTableAPIClientImpl impl = new ServiceNowTableAPIClientImpl (mockConfig );
124+ ServiceNowTableAPIClientImpl implSpy = Mockito .spy (impl );
125+
126+ String jsonResponse = "{\n " +
127+ " \" result\" : {\n " +
128+ " \" columns\" : {\n " +
129+ " \" u_start_time\" : {\n " +
130+ " \" label\" : \" Start Time\" ,\n " +
131+ " \" name\" : \" u_start_time\" ,\n " +
132+ " \" type\" : \" string\" ,\n " +
133+ " \" internal_type\" : \" glide_time\" \n " +
134+ " }\n " +
135+ " }\n " +
136+ " }\n " +
137+ "}" ;
138+
139+ RestAPIResponse mockResponse = new RestAPIResponse (Collections .emptyMap (), jsonResponse , null );
140+ Mockito .doReturn (mockResponse ).when (implSpy ).executeGetWithRetries (Mockito .any ());
141+
142+ Schema schema = implSpy .fetchTableSchema ("u_custom_table" , "dummy-access-token" ,
143+ SourceValueType .SHOW_ACTUAL_VALUE );
144+
145+ Assert .assertNotNull (schema );
146+ Assert .assertEquals ("record" , schema .getDisplayName ());
147+ Assert .assertEquals (1 , schema .getFields ().size ());
148+
149+ Schema .Field field = schema .getField ("u_start_time" );
150+ Assert .assertNotNull (field );
151+
152+ Schema fieldSchema = field .getSchema ().getUnionSchemas ().get (0 );
153+ Assert .assertEquals (Schema .LogicalType .DATETIME , fieldSchema .getLogicalType ());
154+ }
155+
120156 @ Test
121157 public void testFetchTableSchema_DisplayValueType () throws Exception {
122158 ServiceNowConnectorConfig mockConfig = Mockito .mock (ServiceNowConnectorConfig .class );
0 commit comments