@Test public void testGlobalResultInvalid() { final AnalyzerCreationResult<TestAnalyzerType> failedResult = new AnalyzerCreationResult<TestAnalyzerType>( this.testAnalyzerType, ValidationResult.invalidResult("Something global wrong"), createParameterResults(ValidationResult.validResult(), ValidationResult.validResult())); Assert.assertFalse(failedResult.wasSuccessful()); Assert.assertNull(failedResult.getAnalyzer()); Assert.assertFalse(failedResult.getGlobalResult().isValid()); Assert.assertEquals( failedResult.getParameterResults().keySet(), new HashSet<>(Arrays.asList(this.stringParameterSpec, this.intParameterSpec))); Assert.assertTrue(failedResult.getParameterResults().get(this.stringParameterSpec).isValid()); Assert.assertTrue(failedResult.getParameterResults().get(this.intParameterSpec).isValid()); }
@Test public void testSuccessfulCreation() { final AnalyzerCreationResult<TestAnalyzerType> successfulResult = new AnalyzerCreationResult<TestAnalyzerType>( this.testAnalyzer, ValidationResult.validResult(), createParameterResults(ValidationResult.validResult(), ValidationResult.validResult())); Assert.assertTrue(successfulResult.wasSuccessful()); Assert.assertEquals(this.testAnalyzer, successfulResult.getAnalyzer()); Assert.assertTrue(successfulResult.getGlobalResult().isValid()); Assert.assertEquals( successfulResult.getParameterResults().keySet(), new HashSet<>(Arrays.asList(this.stringParameterSpec, this.intParameterSpec))); Assert.assertTrue( successfulResult.getParameterResults().get(this.stringParameterSpec).isValid()); Assert.assertTrue(successfulResult.getParameterResults().get(this.intParameterSpec).isValid()); }