This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit fb5b5bda authored by Michael Breu's avatar Michael Breu :speech_balloon:
Browse files

Mehr Testüberdeckung

parent f1d270cf
2 merge requests!188Merging Peer Reviewing et. al to Master,!164211 peer reviewing functionality
package at.ac.uibk.gitsearch.repository.search;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.Matchers.is;
import java.io.IOException;
import java.util.List;
......@@ -11,6 +7,9 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.node.NodeValidationException;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
......@@ -25,6 +24,7 @@ import at.ac.uibk.gitsearch.service.dto.AutoCompleteEntry;
public class MetaDataRepositoryTests {
@SuppressWarnings("unused")
private static final Logger LOGGER = LogManager.getLogger(MetaDataRepositoryTests.class);
@Autowired
......@@ -42,24 +42,24 @@ public class MetaDataRepositoryTests {
@Autowired
private MetaDataRepository metaDataRepository;
// @Test
// public void testKeywordAutocompletion() throws IOException {
// final List<AutoCompleteEntry> keywordsAutoComplete = metaDataRepository.getKeywordsAutoComplete("Jav");
// org.junit.Assert.assertThat(keywordsAutoComplete, contains(hasProperty("target",is("Java"))));
// }
@Test
public void testKeywordAutocompletion() throws IOException {
final List<AutoCompleteEntry> keywordsAutoComplete = metaDataRepository.getKeywordsAutoComplete("Jav");
assertThat(keywordsAutoComplete, contains(hasProperty("target",is("Java"))));
}
// @Test
// public void testCreatorAutocompletion() throws IOException {
// final List<AutoCompleteEntry> creatorAutoComplete = metaDataRepository.getCreatorAutoComplete("Pod");
// org.junit.Assert.assertThat(creatorAutoComplete, contains(hasProperty("target",is("Stefan Podlipnig"))));
// final List<AutoCompleteEntry> creatorAutoComplete2 = metaDataRepository.getCreatorAutoComplete("Po");
// org.junit.Assert.assertThat(creatorAutoComplete2, contains(hasProperty("target",is("Stefan Podlipnig"))));
// }
@Test
public void testCreatorAutocompletion() throws IOException {
final List<AutoCompleteEntry> creatorAutoComplete = metaDataRepository.getCreatorAutoComplete("Pod");
assertThat(creatorAutoComplete, contains(hasProperty("target",is("Stefan Podlipnig"))));
final List<AutoCompleteEntry> creatorAutoComplete2 = metaDataRepository.getCreatorAutoComplete("Po");
assertThat(creatorAutoComplete2, contains(hasProperty("target",is("Stefan Podlipnig"))));
}
// @Test
// public void testContributorAutocompletion() throws IOException {
// final List<AutoCompleteEntry> contributorAutoComplete = metaDataRepository.getContributorAutoComplete("Bast");
// org.junit.Assert.assertThat(contributorAutoComplete, contains(hasProperty("target",is("Daniel Bastta"))));
// }
@Test
public void testContributorAutocompletion() throws IOException {
final List<AutoCompleteEntry> contributorAutoComplete = metaDataRepository.getContributorAutoComplete("Bast");
assertThat(contributorAutoComplete, contains(hasProperty("target",is("Daniel Bastta"))));
}
}
package at.ac.uibk.gitsearch.service;
import static at.ac.uibk.gitsearch.web.rest.AccountResourceIT.TEST_USER_LOGIN;
import java.io.IOException;
import java.io.InputStream;
import org.gitlab4j.api.GitLabApiException;
import org.junit.Assert;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.test.context.support.WithMockUser;
import at.ac.uibk.gitsearch.GitsearchApp;
@SpringBootTest(classes = GitsearchApp.class)
@WithMockUser(value = TEST_USER_LOGIN, authorities = "sharing")
public class GitLabServiceIT {
@Autowired
GitlabService gitlabService;
final String publicGitLabProjectId = "3";
@Test
public void testGitLabAccess( ) {
Assert.assertTrue(gitlabService.repositoryExists(publicGitLabProjectId));
Assert.assertFalse(gitlabService.repositoryExists("XXXX--keineId--XXX"));
}
@Test
public void testGitLabDownload( ) throws GitLabApiException, IOException {
final InputStream repositoryZip = gitlabService.getRepositoryZip(publicGitLabProjectId);
// schwacher Test :-(
Assert.assertNotNull(repositoryZip);
}
}
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