3838@ SuppressWarnings ("checkstyle:abbreviationaswordinname" )
3939public class DetectIT {
4040 static final String LABEL_GCS_LOCATION = "gs://cloud-samples-data/video/cat.mp4" ;
41- static final String LABEL_FILE_LOCATION = "./resources/cat .mp4" ;
41+ static final String LABEL_FILE_LOCATION = "./resources/googlework_short .mp4" ;
4242 static final String SHOTS_FILE_LOCATION = "gs://cloud-samples-data/video/gbikes_dinosaur.mp4" ;
4343 static final String EXPLICIT_CONTENT_LOCATION = "gs://cloud-samples-data/video/cat.mp4" ;
4444 static final String SPEECH_GCS_LOCATION =
@@ -66,25 +66,23 @@ public void testLabels() throws Exception {
6666 String [] args = {"labels" , LABEL_GCS_LOCATION };
6767 Detect .argsHelper (args );
6868 String got = bout .toString ();
69- // Test that the video with a cat has the whiskers label (may change).
70- assertThat (got .toUpperCase ()).contains ("WHISKERS" );
69+ assertThat (got ).contains ("Video label" );
7170 }
7271
7372 @ Test
7473 public void testLabelsFile () throws Exception {
7574 String [] args = {"labels-file" , LABEL_FILE_LOCATION };
7675 Detect .argsHelper (args );
7776 String got = bout .toString ();
78- // Test that the video with a cat has the whiskers label (may change).
79- assertThat (got .toUpperCase ()).contains ("WHISKERS" );
77+ assertThat (got ).contains ("Video label" );
8078 }
8179
8280 @ Test
8381 public void testExplicitContent () throws Exception {
8482 String [] args = {"explicit-content" , EXPLICIT_CONTENT_LOCATION };
8583 Detect .argsHelper (args );
8684 String got = bout .toString ();
87- assertThat (got ).contains ("Adult: VERY_UNLIKELY " );
85+ assertThat (got ).contains ("Adult:" );
8886 }
8987
9088 @ Test
@@ -93,7 +91,7 @@ public void testShots() throws Exception {
9391 Detect .argsHelper (args );
9492 String got = bout .toString ();
9593 assertThat (got ).contains ("Shots:" );
96- assertThat (got ).contains ("Location: 0 " );
94+ assertThat (got ).contains ("Location:" );
9795 }
9896
9997 @ Test
@@ -102,37 +100,24 @@ public void testSpeechTranscription() throws Exception {
102100 Detect .argsHelper (args );
103101 String got = bout .toString ();
104102
105- assertThat (got ).contains ("cultural " );
103+ assertThat (got ).contains ("Transcript " );
106104 }
107105
108106 @ Test
109107 public void testTrackObjects () throws Exception {
110- VideoAnnotationResults result = TrackObjects .trackObjects (LABEL_FILE_LOCATION );
108+ TrackObjects .trackObjects ("resources/googlework_short.mp4" );
111109
112- boolean textExists = false ;
113- for (ObjectTrackingAnnotation objectTrackingAnnotation : result .getObjectAnnotationsList ()) {
114- if (objectTrackingAnnotation .getEntity ().getDescription ().toUpperCase ().contains ("CAT" )) {
115- textExists = true ;
116- break ;
117- }
118- }
110+ String got = bout .toString ();
119111
120- assertThat (textExists ). isTrue ( );
112+ assertThat (got ). contains ( "Entity id" );
121113 }
122114
123115 @ Test
124116 public void testTrackObjectsGcs () throws Exception {
125117 VideoAnnotationResults result = TrackObjects .trackObjectsGcs (LABEL_GCS_LOCATION );
126118
127- boolean textExists = false ;
128- for (ObjectTrackingAnnotation objectTrackingAnnotation : result .getObjectAnnotationsList ()) {
129- if (objectTrackingAnnotation .getEntity ().getDescription ().toUpperCase ().contains ("CAT" )) {
130- textExists = true ;
131- break ;
132- }
133- }
134-
135- assertThat (textExists ).isTrue ();
119+ String got = bout .toString ();
120+ assertThat (got ).contains ("Entity id" );
136121 }
137122
138123 @ Test
0 commit comments