Search in sources :

Example 21 with DocAnnotationData

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

the class ScheduleDescriptionGeneratorTest method when_collector_returns_one_entry_but_not_with_spring_value_1_result_is_empty.

@Test
public void when_collector_returns_one_entry_but_not_with_spring_value_1_result_is_empty() throws Exception {
    /* prepare */
    DocAnnotationData a = new DocAnnotationData();
    List<DocAnnotationData> list = new ArrayList<>();
    list.add(a);
    when(collector.fetchMustBeDocumentParts()).thenReturn(list);
    /* execute */
    String generated = generatorToTest.generate(collector);
    /* test */
    assertNotNull(generated);
    assertTrue(generated.isEmpty());
}
Also used : ArrayList(java.util.ArrayList) DocAnnotationData(com.mercedesbenz.sechub.docgen.DocAnnotationData) Test(org.junit.Test)

Example 22 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_a_table_is_build.

@Test
public void when_collector_returns_one_entry_with_spring_scheduled_a_table_is_build() throws Exception {
    /* prepare */
    DocAnnotationData a = new DocAnnotationData();
    a.springScheduled = mock(Scheduled.class);
    when(a.springScheduled.cron()).thenReturn("cronjob");
    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 23 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_value_1_result_is_empty.

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

Example 24 with DocAnnotationData

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

the class SystemPropertiesDescriptionGeneratorTest method when_list_contains_one_entry_but_not_with_spring_value_1_result_is_empty.

@Test
public void when_list_contains_one_entry_but_not_with_spring_value_1_result_is_empty() throws Exception {
    /* prepare */
    DocAnnotationData a = new DocAnnotationData();
    List<DocAnnotationData> list = new ArrayList<>();
    list.add(a);
    /* execute */
    String generated = generatorToTest.generate(list);
    /* test */
    assertNotNull(generated);
    assertTrue(generated.isEmpty());
}
Also used : ArrayList(java.util.ArrayList) 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