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.

Default value

There is no default value, this parameter is mandatory!

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+", "")));
1 add start class as string
2 add start method as string
3 create generator object with config from builder
4 generate diagram text

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:

0001_basic_caller_test_diagram