@Test
public void githubHrefProducer() {
Injector injector = Guice.createInjector(new DependencyGraphModule(
GraphHrefType.GITHUB.getHrefProducerClass(), "https://github.com/puppetlabs/geppetto/master"));
IHrefProducer producer = injector.getInstance(IHrefProducer.class);
Export fakeExport = new Export() {
private static final long serialVersionUID = 1L;
@Override
public String getDefaultValueText() {
return null;
}
@Override
public EClass getEClass() {
return null;
}
@Override
public File getFile() {
return new File("/foo/bar/about.html");
}
@Override
public String getLastNameSegment() {
return ".html";
}
@Override
public int getLength() {
return -1;
}
@Override
public int getLine() {
return 23;
}
@Override
public String getName() {
return null;
}
@Override
public String getNameWithoutLastSegment() {
return null;
}
@Override
public String getParentName() {
return null;
}
@Override
public int getStart() {
return -1;
}
};
String result = producer.href(fakeExport, new File("/foo/bar/"));
assertEquals("https://github.com/puppetlabs/geppetto/master/about.html#L23", result);
}