startMethod
Description
This is a mandatory parameter and therefore it has to be set in the constructor of the PlantUMLSequenceDiagramConfigBuilder class. If you specify it, it has to be a unique method name or else a random method with the same name is chosen.
If this method can not be found a NotFoundException is raised.
Example
Here is an example from the JUnit tests using this configuration parameter:
// ARRANGE
PlantUMLSequenceDiagramConfigBuilder builder = new PlantUMLSequenceDiagramConfigBuilder(CallerA.class.getName(), (1)
"callSomething"); (2)
PlantUMLSequenceDiagramGenerator generator = new PlantUMLSequenceDiagramGenerator(builder.build()); (3)
String expectedDiagramText = IOUtils.toString(Objects.requireNonNull(classLoader.getResource("sequence/0001_basic_caller_test.txt")),
StandardCharsets.UTF_8);
// ACT
String generatedDiagram = generator.generateDiagramText(); (4)
// ASSERT
assertAll(() -> assertNotNull(generatedDiagram), () -> assertEquals(expectedDiagramText.replaceAll("\\s+", ""),
generatedDiagram.replaceAll("\\s+", "")));
the result of this generation is
@startuml
participant CallerA
participant CallerB
activate CallerA
CallerA -> CallerB : callSomething
activate CallerB
CallerB -> CallerB : privateMethodCall
activate CallerB
CallerB --> CallerB
deactivate CallerB
CallerB -> CallerB : protectedMethodCall
activate CallerB
CallerB --> CallerB
deactivate CallerB
CallerB --> CallerA
deactivate CallerB
CallerA -> CallerB : callSomethingElse
activate CallerB
CallerB --> CallerA
deactivate CallerB
deactivate CallerA
@enduml
which is rendered in PlantUML this way: