@@ -51,60 +51,65 @@ public static void setUp() {
51
51
@ Test
52
52
public void autoCompleteSampleTest () throws Exception {
53
53
AutoCompleteSample .main ();
54
- assertThat (bout .toString ()).containsMatch (
55
- ".*completionResults.*\" suggestion\" :\" Google\" ,\" type\" :\" COMPANY_NAME\" }.*\n "
56
- + ".*completionResults.*\" suggestion\" :\" Software Engineer\" ,\" type\" :\" JOB_TITLE\" .*\n "
57
- + ".*completionResults.*\" suggestion\" :\" Software Engineer\" ,\" type\" :\" JOB_TITLE\" .*\n "
58
- );
54
+ assertThat (bout .toString ())
55
+ .containsMatch (
56
+ ".*completionResults.*\" suggestion\" :"
57
+ + "\" Google\" ,\" type\" :\" COMPANY_NAME\" }.*\n "
58
+ + ".*completionResults.*\" suggestion\" "
59
+ + ":\" Software Engineer\" ,\" type\" :\" JOB_TITLE\" .*\n "
60
+ + ".*completionResults.*\" suggestion\" "
61
+ + ":\" Software Engineer\" ,\" type\" :\" JOB_TITLE\" .*\n " );
59
62
bout .reset ();
60
63
}
61
64
62
65
@ Test
63
66
public void basicCompanySampleTest () throws Exception {
64
67
BasicCompanySample .main ();
65
- assertThat (bout .toString ()). containsMatch (
66
- ".*Company generated:.* \n "
67
- + ".*Company created :.*\n "
68
- + ".*Company existed :.*\n "
69
- + ".*Company updated:.*elgoog .*\n "
70
- + ".*Company updated:.*changedTitle .*\n "
71
- + ".*Company deleted .*\n "
72
- );
68
+ assertThat (bout .toString ())
69
+ . containsMatch (
70
+ ".*Company generated :.*\n "
71
+ + ".*Company created :.*\n "
72
+ + ".*Company existed: .*\n "
73
+ + ".*Company updated:.*elgoog .*\n "
74
+ + ".*Company updated:.*changedTitle .*\n "
75
+ + ".*Company deleted.* \n " );
73
76
bout .reset ();
74
77
}
75
78
76
79
@ Test
77
80
public void basicJobSampleTest () throws Exception {
78
81
BasicJobSample .main ();
79
- assertThat (bout .toString ()). containsMatch (
80
- ".*Job generated:.* \n "
81
- + ".*Job created :.*\n "
82
- + ".*Job existed :.*\n "
83
- + ".*Job updated:.*changedDescription .*\n "
84
- + ".*Job updated:.*changedJobTitle .*\n "
85
- + ".*Job deleted .*\n "
86
- );
82
+ assertThat (bout .toString ())
83
+ . containsMatch (
84
+ ".*Job generated :.*\n "
85
+ + ".*Job created :.*\n "
86
+ + ".*Job existed: .*\n "
87
+ + ".*Job updated:.*changedDescription .*\n "
88
+ + ".*Job updated:.*changedJobTitle .*\n "
89
+ + ".*Job deleted.* \n " );
87
90
bout .reset ();
88
91
}
89
92
90
93
@ Test
91
94
public void batchOperationSampleTest () throws Exception {
92
95
BatchOperationSample .main ();
93
- assertThat (bout .toString ()).containsMatch (".*"
94
- + "Company generated:.*\n Company created:.*\n "
95
- + "Create Job:.*\n Create Job:.*\n "
96
- + "Update Job:.*Engineer in Mountain View.*\n Update Job:.*Engineer in Mountain View.*\n "
97
- + "Job deleted.*\n Job deleted.*\n "
98
- + "Company deleted.*\n "
99
- );
96
+ assertThat (bout .toString ())
97
+ .containsMatch (
98
+ ".*"
99
+ + "Company generated:.*\n Company created:.*\n "
100
+ + "Create Job:.*\n Create Job:.*\n "
101
+ + "Update Job:.*Engineer in Mountain View.*\n "
102
+ + "Update Job:.*Engineer in Mountain View.*\n "
103
+ + "Job deleted.*\n Job deleted.*\n "
104
+ + "Company deleted.*\n " );
100
105
bout .reset ();
101
106
}
102
107
103
108
@ Test
104
109
public void commuteSearchSampleTest () throws Exception {
105
110
CommuteSearchSample .main ();
106
111
String result = bout .toString ();
107
- assertThat (result ).containsMatch ( ".*matchingJobs.*1600 Amphitheatre Pkwy.* " );
112
+ assertThat (result ).contains ( "Search jobs for commute results: " );
108
113
bout .reset ();
109
114
}
110
115
@@ -118,47 +123,44 @@ public void customAttributeSampleTest() throws Exception {
118
123
Thread .sleep (1000 );
119
124
}
120
125
121
- assertThat (bout .toString ())
122
- . containsMatch (
123
- ".*Job created:.*jobWithACustomAttribute.* \n "
124
- + ".*matchingJobs.*jobWithACustomAttribute.* \n " );
126
+ assertThat (bout .toString ()). contains ( "Job created:" );
127
+ assertThat ( bout . toString ()). contains ( "Custom search job results (String value):" );
128
+ assertThat ( bout . toString ()). contains ( "Custom search job results (Long value):" );
129
+ assertThat ( bout . toString ()). contains ( "Custom search job results (multiple value): " );
125
130
bout .reset ();
126
131
}
127
132
128
133
@ Test
129
134
public void emailAlertSearchSampleTest () throws Exception {
130
135
EmailAlertSearchSample .main ();
131
- assertThat (bout .toString ()).contains ("matchingJobs " );
136
+ assertThat (bout .toString ()).contains ("Search jobs for alert results: " );
132
137
bout .reset ();
133
138
}
134
139
135
140
@ Test
136
141
public void featuredJobSearchSampleTest () throws Exception {
137
142
FeaturedJobsSearchSample .main ();
138
- assertThat (bout .toString ()).contains ("matchingJobs " );
143
+ assertThat (bout .toString ()).contains ("Featured jobs results: " );
139
144
bout .reset ();
140
145
}
141
146
142
147
@ Test
143
148
public void generalSearchSampleTest () throws Exception {
144
149
GeneralSearchSample .main ();
145
- assertThat (bout .toString ())
146
- .containsMatch (
147
- ".*matchingJobs.*\n "
148
- + ".*matchingJobs.*\n "
149
- + ".*matchingJobs.*\n "
150
- + ".*matchingJobs.*\n "
151
- + ".*matchingJobs.*\n "
152
- + ".*matchingJobs.*\n "
153
- + ".*matchingJobs.*\n " );
150
+ assertThat (bout .toString ()).contains ("Simple search jobs results:" );
151
+ assertThat (bout .toString ()).contains ("Category search jobs results:" );
152
+ assertThat (bout .toString ()).contains ("Employee type search jobs results:" );
153
+ assertThat (bout .toString ()).contains ("Search results on jobs with a date range:" );
154
+ assertThat (bout .toString ()).contains ("Search results on jobs with a language code:" );
155
+ assertThat (bout .toString ()).contains ("Search results by display name of company:" );
156
+ assertThat (bout .toString ()).contains ("Search results by compensation:" );
154
157
bout .reset ();
155
158
}
156
159
157
160
@ Test
158
161
public void histogramSampleTest () throws Exception {
159
162
HistogramSample .main ();
160
- assertThat (bout .toString ()).contains ("COMPANY_ID" );
161
- assertThat (bout .toString ()).contains ("someFieldName1" );
163
+ assertThat (bout .toString ()).contains ("Histogram search results:" );
162
164
bout .reset ();
163
165
}
164
166
@@ -172,13 +174,15 @@ public void jobServiceQuickStartTest() throws Exception {
172
174
@ Test
173
175
public void locationSearchSampleTest () throws Exception {
174
176
LocationSearchSample .main ();
175
- assertThat (bout .toString ()).containsMatch (
176
- ".*locationFilters.*matchingJobs.*\n "
177
- + ".*locationFilters.*matchingJobs.*\n "
178
- + ".*locationFilters.*matchingJobs.*\n "
179
- + ".*locationFilters.*matchingJobs.*\n "
180
- + ".*locationFilters.*matchingJobs.*\n "
181
- );
177
+ assertThat (bout .toString ()).contains ("Basic location search results:" );
178
+
179
+ assertThat (bout .toString ()).contains ("Keyword location search results:" );
180
+
181
+ assertThat (bout .toString ()).contains ("City locations search results:" );
182
+
183
+ assertThat (bout .toString ()).contains ("Multiple locations search results:" );
184
+
185
+ assertThat (bout .toString ()).contains ("Broadening locations search results:" );
182
186
bout .reset ();
183
187
}
184
188
}
0 commit comments