1 package jp.sourceforge.stigmata;
3 import jp.sourceforge.stigmata.spi.BirthmarkService;
5 import org.junit.Assert;
6 import org.junit.Before;
11 * @author Haruaki TAMADA
13 public class StigmataTest{
14 private BirthmarkContext context;
15 private BirthmarkEnvironment environment;
18 public void prepare(){
19 Stigmata stigmata = Stigmata.getInstance();
20 context = stigmata.createContext();
21 environment = context.getEnvironment();
25 public void checkAvailableServices() throws Exception{
26 Assert.assertNotNull(environment.getService("smc"));
27 Assert.assertNotNull(environment.getService("cvfv"));
28 Assert.assertNotNull(environment.getService("is"));
29 Assert.assertNotNull(environment.getService("uc"));
33 public void checkSmcBirthmarkService() throws Exception{
34 BirthmarkService service = environment.getService("smc");
36 Assert.assertNotNull(service.getComparator());
37 Assert.assertNotNull(service.getExtractor());
39 "jp.sourceforge.stigmata.birthmarks.comparators.PlainBirthmarkComparator",
40 service.getComparator().getClass().getName()
43 "jp.sourceforge.stigmata.birthmarks.smc.SequentialMethodCallBirthmarkExtractor",
44 service.getExtractor().getClass().getName()
49 public void checkCvfvBirthmarkService() throws Exception{
50 BirthmarkService service = environment.getService("cvfv");
52 Assert.assertNotNull(service.getComparator());
53 Assert.assertNotNull(service.getExtractor());
55 "jp.sourceforge.stigmata.birthmarks.comparators.PlainBirthmarkComparator",
56 service.getComparator().getClass().getName()
59 "jp.sourceforge.stigmata.birthmarks.cvfv.ConstantValueOfFieldVariableBirthmarkExtractor",
60 service.getExtractor().getClass().getName()
65 public void checkIsBirthmarkService() throws Exception{
66 BirthmarkService service = environment.getService("is");
68 Assert.assertNotNull(service.getComparator());
69 Assert.assertNotNull(service.getExtractor());
71 "jp.sourceforge.stigmata.birthmarks.comparators.PlainBirthmarkComparator",
72 service.getComparator().getClass().getName()
75 "jp.sourceforge.stigmata.birthmarks.is.InheritanceStructureBirthmarkExtractor",
76 service.getExtractor().getClass().getName()
81 public void checkUcBirthmarkService() throws Exception{
82 BirthmarkService service = environment.getService("uc");
84 Assert.assertNotNull(service.getComparator());
85 Assert.assertNotNull(service.getExtractor());
87 "jp.sourceforge.stigmata.birthmarks.comparators.LogicalAndBirthmarkComparator",
88 service.getComparator().getClass().getName()
91 "jp.sourceforge.stigmata.birthmarks.uc.UsedClassesBirthmarkExtractor",
92 service.getExtractor().getClass().getName()