use of com.redhat.devtools.alizer.api.Language in project intellij-tekton by redhat-developer.
the class HubItemScoreTest method Compare_2HubItems_VerifyCalculatedScoreWithDescription.
@Test
public void Compare_2HubItems_VerifyCalculatedScoreWithDescription() {
Language lang = new Language("First", Arrays.asList("alias1", "alias2"), 99.0, Arrays.asList("framework1"), Collections.emptyList(), false);
Language lang2 = new Language("Second", Arrays.asList("alias3", "alias4"), 1.0, Arrays.asList("framework2"), Collections.emptyList(), false);
List<Language> languages = Arrays.asList(lang, lang2);
Tag tag2 = buildTag("framework2");
Tag tag3 = buildTag("framework3");
HubItem hubItem1 = buildHubItem("name", "this is the first item for the first language", Collections.emptyList());
HubItem hubItem2 = buildHubItem("name2", "blabla", Arrays.asList(tag2, tag3));
HubItemScore hubItemScore = new HubItemScore(languages);
assertEquals(2, hubItemScore.compare(hubItem1, hubItem2));
}
use of com.redhat.devtools.alizer.api.Language in project intellij-tekton by redhat-developer.
the class HubItemScoreTest method Compare_1HubItemAndValue_VerifyCalculatedScoreWithOnlyName.
@Test
public void Compare_1HubItemAndValue_VerifyCalculatedScoreWithOnlyName() {
Language lang = new Language("First", Collections.emptyList(), 99.0, false);
Language lang2 = new Language("Second", Collections.emptyList(), 1.0, false);
List<Language> languages = Arrays.asList(lang, lang2);
HubItem hubItem1 = buildHubItem("Second", "", Collections.emptyList());
HubItemScore hubItemScore = new HubItemScore(languages);
assertEquals(19, hubItemScore.compare(hubItem1, 1));
}
use of com.redhat.devtools.alizer.api.Language in project intellij-tekton by redhat-developer.
the class HubItemScoreTest method Compare_2HubItems_VerifyCalculatedScoreWithAliases.
@Test
public void Compare_2HubItems_VerifyCalculatedScoreWithAliases() {
Language lang = new Language("First", Arrays.asList("alias1", "alias2"), 99.0, false);
Language lang2 = new Language("Second", Arrays.asList("alias3", "alias4"), 1.0, false);
List<Language> languages = Arrays.asList(lang, lang2);
HubItem hubItem1 = buildHubItem("alias1", "", Collections.emptyList());
HubItem hubItem2 = buildHubItem("alias4", "", Collections.emptyList());
HubItemScore hubItemScore = new HubItemScore(languages);
assertEquals(20, hubItemScore.compare(hubItem1, hubItem2));
}
use of com.redhat.devtools.alizer.api.Language in project intellij-tekton by redhat-developer.
the class HubItemScoreTest method Compare_1HubItemAndValue_VerifyCalculatedScoreWithFrameworks.
@Test
public void Compare_1HubItemAndValue_VerifyCalculatedScoreWithFrameworks() {
Language lang = new Language("First", Arrays.asList("alias1", "alias2"), 99.0, Arrays.asList("framework1"), Collections.emptyList(), false);
Language lang2 = new Language("Second", Arrays.asList("alias3", "alias4"), 1.0, Arrays.asList("framework2"), Collections.emptyList(), false);
List<Language> languages = Arrays.asList(lang, lang2);
Tag tag = buildTag("framework1");
HubItem hubItem1 = buildHubItem("name", "", Arrays.asList(tag));
HubItemScore hubItemScore = new HubItemScore(languages);
assertEquals(19, hubItemScore.compare(hubItem1, 1));
}
use of com.redhat.devtools.alizer.api.Language in project intellij-tekton by redhat-developer.
the class HubItemScoreTest method Compare_2HubItems_VerifyCalculatedScoreWithFrameworks.
@Test
public void Compare_2HubItems_VerifyCalculatedScoreWithFrameworks() {
Language lang = new Language("First", Arrays.asList("alias1", "alias2"), 99.0, Arrays.asList("framework1"), Collections.emptyList(), false);
Language lang2 = new Language("Second", Arrays.asList("alias3", "alias4"), 1.0, Arrays.asList("framework2"), Collections.emptyList(), false);
List<Language> languages = Arrays.asList(lang, lang2);
Tag tag = buildTag("framework1");
Tag tag2 = buildTag("framework2");
Tag tag3 = buildTag("framework3");
HubItem hubItem1 = buildHubItem("name", "", Arrays.asList(tag));
HubItem hubItem2 = buildHubItem("name2", "", Arrays.asList(tag2, tag3));
HubItemScore hubItemScore = new HubItemScore(languages);
assertEquals(10, hubItemScore.compare(hubItem1, hubItem2));
}
Aggregations