38
38
@ SuppressWarnings ("checkstyle:abbreviationaswordinname" )
39
39
public class DetectIT {
40
40
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" ;
42
42
static final String SHOTS_FILE_LOCATION = "gs://cloud-samples-data/video/gbikes_dinosaur.mp4" ;
43
43
static final String EXPLICIT_CONTENT_LOCATION = "gs://cloud-samples-data/video/cat.mp4" ;
44
44
static final String SPEECH_GCS_LOCATION =
@@ -66,25 +66,23 @@ public void testLabels() throws Exception {
66
66
String [] args = {"labels" , LABEL_GCS_LOCATION };
67
67
Detect .argsHelper (args );
68
68
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" );
71
70
}
72
71
73
72
@ Test
74
73
public void testLabelsFile () throws Exception {
75
74
String [] args = {"labels-file" , LABEL_FILE_LOCATION };
76
75
Detect .argsHelper (args );
77
76
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" );
80
78
}
81
79
82
80
@ Test
83
81
public void testExplicitContent () throws Exception {
84
82
String [] args = {"explicit-content" , EXPLICIT_CONTENT_LOCATION };
85
83
Detect .argsHelper (args );
86
84
String got = bout .toString ();
87
- assertThat (got ).contains ("Adult: VERY_UNLIKELY " );
85
+ assertThat (got ).contains ("Adult:" );
88
86
}
89
87
90
88
@ Test
@@ -93,7 +91,7 @@ public void testShots() throws Exception {
93
91
Detect .argsHelper (args );
94
92
String got = bout .toString ();
95
93
assertThat (got ).contains ("Shots:" );
96
- assertThat (got ).contains ("Location: 0 " );
94
+ assertThat (got ).contains ("Location:" );
97
95
}
98
96
99
97
@ Test
@@ -102,37 +100,24 @@ public void testSpeechTranscription() throws Exception {
102
100
Detect .argsHelper (args );
103
101
String got = bout .toString ();
104
102
105
- assertThat (got ).contains ("cultural " );
103
+ assertThat (got ).contains ("Transcript " );
106
104
}
107
105
108
106
@ Test
109
107
public void testTrackObjects () throws Exception {
110
- VideoAnnotationResults result = TrackObjects .trackObjects (LABEL_FILE_LOCATION );
108
+ TrackObjects .trackObjects ("resources/googlework_short.mp4" );
111
109
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 ();
119
111
120
- assertThat (textExists ). isTrue ( );
112
+ assertThat (got ). contains ( "Entity id" );
121
113
}
122
114
123
115
@ Test
124
116
public void testTrackObjectsGcs () throws Exception {
125
117
VideoAnnotationResults result = TrackObjects .trackObjectsGcs (LABEL_GCS_LOCATION );
126
118
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" );
136
121
}
137
122
138
123
@ Test
0 commit comments