Class Model

All Implemented Interfaces:
Builder<Model.RuntimeModel>

public class Model extends BuilderBase<Model,Model.RuntimeModel>

Model

The Model,or graph, is a collection of edges and vertices,

The model is a description of the expected behavior of a system under test. It contains lists of edges and vertices, which creates a directed graph.

In a model, the edges represents the actions during a test, and the vertices are where the verifications are performed.
Author:
Nils Olsson
  • Constructor Details

    • Model

      public Model()
      Create a new Model
    • Model

      public Model(Model.RuntimeModel model)
      Create a new Model, based on a existing RuntimeModel
      Parameters:
      model - A RuntimeModel that the new Model will be based on.
  • Method Details

    • addVertex

      public Model addVertex(Vertex vertex)
      Adds a vertex to the model.
      Parameters:
      vertex - The vertex to be added.
      Returns:
      The model
    • addEdge

      public Model addEdge(Edge edge)
      Adds an edge to the model.

      If either the source or target vertex of the edge is not in the model, they will be automatically added as well.

      Parameters:
      edge - The edge to be added.
      Returns:
      The model.
    • deleteEdge

      public Model deleteEdge(Edge edge)
      Delete an edge from the model.

      Will remove the edge from the model.

      Parameters:
      edge - The edge to be deleted.
      Returns:
      The model.
    • deleteVertex

      public Model deleteVertex(Vertex vertex)
      Delete a vertex from the model.

      Will remove a vertex from the model. Any edges that has the vertex as either source or target, will also be deleted from the model.

      Parameters:
      vertex - The vertex to be deleted.
      Returns:
      The model.
    • addAction

      public Model addAction(Action action)
      Adds an action to the model.

      Before a model is being traversed, it will execute all its actions. This is typically needed to initiate variables and data.
      Parameters:
      action - The action to be added.
      Returns:
      The model
    • addActions

      public Model addActions(Action... actions)
    • addActions

      public Model addActions(List<Action> actions)
    • setActions

      public Model setActions(List<Action> actions)
      Assign a list of actions to the model.
      Parameters:
      actions - A list of actions
      Returns:
      The model
      See Also:
    • getActions

      public List<Action> getActions()
      Gets the list of actions associated with the model.
      Returns:
      List of actions
      See Also:
    • getVertices

      public List<Vertex> getVertices()
      Gets the list of vertices of the model.
      Returns:
      The list of vertices
    • getEdges

      public List<Edge> getEdges()
      Gets the list of edges of the model.
      Returns:
      List of edges
    • setPredefinedPath

      public Model setPredefinedPath(List<Edge> predefinedPath)
    • getPredefinedPath

      public List<Edge> getPredefinedPath()
    • hasPredefinedPath

      public boolean hasPredefinedPath()
    • build

      public Model.RuntimeModel build()
      Creates an immutable model from this model.
      Returns:
      An immutable vertex as a RuntimeModel