Search in sources :

Example 6 with DocAnnotationData

use of com.mercedesbenz.sechub.docgen.DocAnnotationData in project sechub by mercedes-benz.

the class ScheduleDescriptionGeneratorTest method when_collector_returns_one_entry_with_spring_scheduled_initialDelayString_a_table_is_build.

@Test
public void when_collector_returns_one_entry_with_spring_scheduled_initialDelayString_a_table_is_build() throws Exception {
    /* prepare */
    DocAnnotationData a = new DocAnnotationData();
    a.springScheduled = mock(Scheduled.class);
    when(a.springScheduled.initialDelayString()).thenReturn("initialDelayString");
    List<DocAnnotationData> list = new ArrayList<>();
    list.add(a);
    when(collector.fetchMustBeDocumentParts()).thenReturn(list);
    /* execute */
    String generated = generatorToTest.generate(collector);
    /* test */
    assertNotNull(generated);
    assertFalse(generated.isEmpty());
    assertTrue(generated.indexOf("|===") != -1);
}
Also used : Scheduled(org.springframework.scheduling.annotation.Scheduled) ArrayList(java.util.ArrayList) DocAnnotationData(com.mercedesbenz.sechub.docgen.DocAnnotationData) Test(org.junit.Test)

Example 7 with DocAnnotationData

use of com.mercedesbenz.sechub.docgen.DocAnnotationData in project sechub by mercedes-benz.

the class SystemPropertiesDescriptionGeneratorTest method when_collector_returns_one_entry_with_spring_value_1_a_table_is_build.

@Test
public void when_collector_returns_one_entry_with_spring_value_1_a_table_is_build() throws Exception {
    /* prepare */
    DocAnnotationData a = new DocAnnotationData();
    a.springValue = "${something}";
    a.description = "the description";
    List<DocAnnotationData> list = new ArrayList<>();
    list.add(a);
    /* execute */
    String generated = generatorToTest.generate(list);
    /* test */
    assertNotNull(generated);
    assertFalse(generated.isEmpty());
    assertTrue(generated.indexOf("|===") != -1);
}
Also used : ArrayList(java.util.ArrayList) DocAnnotationData(com.mercedesbenz.sechub.docgen.DocAnnotationData) Test(org.junit.Test)

Example 8 with DocAnnotationData

use of com.mercedesbenz.sechub.docgen.DocAnnotationData in project sechub by mercedes-benz.

the class AnnotationDataLocationExtractorTest method data_with_field_results_in_correct_string.

@Test
public void data_with_field_results_in_correct_string() throws Exception {
    /* prepare */
    DocAnnotationData data = new DocAnnotationData();
    data.linkedField = getClass().getDeclaredField("extractorToTest");
    /* execute */
    String result = extractorToTest.extractLocation(data);
    /* test */
    assertEquals("Field:AnnotationDataLocationExtractorTest.extractorToTest", result);
}
Also used : DocAnnotationData(com.mercedesbenz.sechub.docgen.DocAnnotationData) Test(org.junit.Test)

Example 9 with DocAnnotationData

use of com.mercedesbenz.sechub.docgen.DocAnnotationData in project sechub by mercedes-benz.

the class AnnotationDataLocationExtractorTest method data_with_method_results_in_correct_string.

@Test
public void data_with_method_results_in_correct_string() throws Exception {
    /* prepare */
    DocAnnotationData data = new DocAnnotationData();
    data.linkedMethod = getClass().getMethod("data_with_method_results_in_correct_string");
    /* execute */
    String result = extractorToTest.extractLocation(data);
    /* test */
    assertEquals("Method:AnnotationDataLocationExtractorTest#data_with_method_results_in_correct_string", result);
}
Also used : DocAnnotationData(com.mercedesbenz.sechub.docgen.DocAnnotationData) Test(org.junit.Test)

Example 10 with DocAnnotationData

use of com.mercedesbenz.sechub.docgen.DocAnnotationData in project sechub by mercedes-benz.

the class AnnotationDataLocationExtractorTest method data_with_class_results_in_correct_string.

@Test
public void data_with_class_results_in_correct_string() throws Exception {
    /* prepare */
    DocAnnotationData data = new DocAnnotationData();
    data.linkedClass = AnnotationDataLocationExtractorTest.class;
    /* execute */
    String result = extractorToTest.extractLocation(data);
    /* test */
    assertEquals("Class:AnnotationDataLocationExtractorTest", result);
}
Also used : DocAnnotationData(com.mercedesbenz.sechub.docgen.DocAnnotationData) Test(org.junit.Test)

Aggregations

DocAnnotationData (com.mercedesbenz.sechub.docgen.DocAnnotationData)24 Test (org.junit.Test)15 ArrayList (java.util.ArrayList)7 Scheduled (org.springframework.scheduling.annotation.Scheduled)4 SortedSet (java.util.SortedSet)3 TreeMap (java.util.TreeMap)3 SpringValue (com.mercedesbenz.sechub.docgen.spring.SpringValueExtractor.SpringValue)2 Map (java.util.Map)2 SpringSchedule (com.mercedesbenz.sechub.docgen.spring.SpringScheduleExtractor.SpringSchedule)1 MustBeDocumented (com.mercedesbenz.sechub.sharedkernel.MustBeDocumented)1 AnnotatedElement (java.lang.reflect.AnnotatedElement)1 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 Value (org.springframework.beans.factory.annotation.Value)1