Commit c1749793 authored by Johannes Salentin's avatar Johannes Salentin
Browse files

Ambiguous Viewpoint

parent 642cfe44
Pipeline #159920 passed with stages
in 1 minute and 22 seconds
This diff is collapsed.
......@@ -13,6 +13,7 @@ public class EASmellDetector {
// register detectors
List<Detector> detectors = new ArrayList<>();
detectors.add(new AmbiguousViewpoint());
detectors.add(new CyclicDependency());
detectors.add(new DeadComponent());
detectors.add(new DenseStructure());
......
package de.example.smells;
import de.example.model.Diagram;
import java.util.List;
public class AmbiguousViewpoint extends Detector {
public AmbiguousViewpoint() {
super("Ambiguous Viewpoint");
}
public List<EASmell> detect() {
for (Diagram view : model.getViews()) {
if (view.getViewpoint() == null) {
addToSmells(new EASmell(getSmellName(), null, " at the View \"" + view.getNameGroup().get(0).getValue() + "\" (" + view.getIdentifier() + ")"));
}
}
return result;
}
}
package de.example.smells;
import de.example.main.ModelAdapter;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class TestAmbiguousViewpoint {
private AmbiguousViewpoint detector;
@BeforeAll
void init() {
ModelAdapter model = new ModelAdapter("CentralModel.xml", null);
Detector.setModel(model);
detector = new AmbiguousViewpoint();
}
@Test
void test() {
assertEquals(detector.detect().size(), 1);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment