@Test public void testCheckNoParam() { when(mongoDbInputMeta.getJsonQuery()).thenReturn("{$unwind : 'foo'}"); mongoDbBasicValidation.checkStep(checkStepsExtension, dataServiceMeta, log); verify(remarks, times(1)).add(any(CheckResultInterface.class)); }
@Test public void testCheckNoParamJsonQueryisNull() { mongoDbBasicValidation.checkStep(checkStepsExtension, dataServiceMeta, log); // make sure something was added to remarks verify(remarks, times(1)).add(any(CheckResultInterface.class)); }
@Test public void testCheckNoParamForDefinedOpt() { when(mongoDbInputMeta.getJsonQuery()).thenReturn("{$unwind : 'foo'}"); setupMockedParamGen("testParam", "testStep"); when(stepMeta.getName()).thenReturn("testStep"); mongoDbBasicValidation.checkStep(checkStepsExtension, dataServiceMeta, log); verify(remarks, times(2)).add(any(CheckResultInterface.class)); }
@Test public void testCheckNoWarningsWithParam() { when(mongoDbInputMeta.getJsonQuery()).thenReturn("{$unwind : 'foo'}, {$match : ${baz}}"); space.setVariable("baz", "foo='123'"); mongoDbBasicValidation.checkStep(checkStepsExtension, dataServiceMeta, log); verify(remarks, never()).add(any(CheckResultInterface.class)); }
@Test public void testCheckJsonOutputType() { when(mongoDbInputMeta.getOutputJson()).thenReturn(true); mongoDbBasicValidation.checkStep(checkStepsExtension, dataServiceMeta, log); // 2 remarks added, one for json output type, one for no param set. verify(remarks, times(2)).add(any(CheckResultInterface.class)); }
@Test public void testCheckOkWithParam() { when(mongoDbInputMeta.getJsonQuery()).thenReturn("{$unwind : 'foo'}, {$match : ${testParam}}"); space.setVariable("testParam", "{foo :'123'}"); setupMockedParamGen("testParam", "testStep"); when(stepMeta.getName()).thenReturn("testStep"); mongoDbBasicValidation.checkStep(checkStepsExtension, dataServiceMeta, log); verify(remarks, never()).add(any(CheckResultInterface.class)); }
@Test public void testIsApplicable() { assertTrue(mongoDbBasicValidation.supportsStep(stepMeta, log)); }