6060
6161import static feast .FeastMatchers .hasCount ;
6262import static feast .ToOrderedFeatureRows .orderedFeatureRow ;
63+ import static feast .storage .MockErrorsStore .MOCK_ERRORS_STORE_TYPE ;
6364import static org .junit .Assert .assertEquals ;
6465import static org .junit .Assert .fail ;
6566
@@ -78,7 +79,7 @@ public ImportJobOptions initOptions() {
7879 Path path = Paths .get (Resources .getResource ("core_specs/" ).getPath ());
7980 ImportJobOptions options = PipelineOptionsFactory .create ().as (ImportJobOptions .class );
8081 options .setCoreApiSpecPath (path .toString ());
81- options .setErrorsStoreType (MockErrorsStore . MOCK_ERRORS_STORE_TYPE );
82+ options .setErrorsStoreType (MOCK_ERRORS_STORE_TYPE );
8283 return options ;
8384 }
8485
@@ -108,14 +109,12 @@ public void testImportCSV() throws IOException {
108109 importSpec = initImportSpec (importSpec , csvFile .toString ());
109110
110111 ImportJobOptions options = initOptions ();
112+ options .setErrorsStoreType (MOCK_ERRORS_STORE_TYPE );
111113
112114 Injector injector =
113115 Guice .createInjector (
114116 new ImportJobModule (options , importSpec ), new TestPipelineModule (testPipeline ));
115117
116- MockErrorsStore mockErrorStore = new MockErrorsStore ();
117- ErrorsStoreService .register (mockErrorStore );
118-
119118 ImportJob job = injector .getInstance (ImportJob .class );
120119 injector .getInstance (ImportJob .class );
121120 job .expand ();
@@ -130,7 +129,7 @@ public void testImportCSV() throws IOException {
130129 .apply ("flatten warehouse input" , Flatten .pCollections ());
131130
132131 PCollection <FeatureRowExtended > writtenToErrors =
133- PCollectionList .of ((( MockErrorsStore ) ErrorsStoreService .get ()).getWrite ().getInputs ())
132+ PCollectionList .of ((ErrorsStoreService .get (MockErrorsStore . class )).getWrite ().getInputs ())
134133 .apply ("flatten errors input" , Flatten .pCollections ());
135134
136135 List <FeatureRow > expectedRows =
@@ -248,14 +247,12 @@ public void testImportWithErrors() throws IOException {
248247 importSpec = initImportSpec (importSpec , csvFile .toString ());
249248
250249 ImportJobOptions options = initOptions ();
250+ options .setErrorsStoreType (MOCK_ERRORS_STORE_TYPE );
251251
252252 Injector injector =
253253 Guice .createInjector (
254254 new ImportJobModule (options , importSpec ), new TestPipelineModule (testPipeline ));
255255
256- MockErrorsStore mockErrorStore = new MockErrorsStore ();
257- ErrorsStoreService .register (mockErrorStore );
258-
259256 ImportJob job = injector .getInstance (ImportJob .class );
260257
261258 injector .getInstance (ImportJob .class );
@@ -266,7 +263,7 @@ public void testImportWithErrors() throws IOException {
266263 .apply ("flatten serving input" , Flatten .pCollections ());
267264
268265 PCollection <FeatureRowExtended > writtenToErrors =
269- PCollectionList .of ((( MockErrorsStore ) ErrorsStoreService .get () ).getWrite ().getInputs ())
266+ PCollectionList .of (ErrorsStoreService .get (MockErrorsStore . class ).getWrite ().getInputs ())
270267 .apply ("flatten errors input" , Flatten .pCollections ());
271268
272269 PAssert .that (writtenToErrors )
0 commit comments