add tests for Arch
This commit is contained in:
		
							parent
							
								
									c3e55395aa
								
							
						
					
					
						commit
						3b558c2caf
					
				
							
								
								
									
										60
									
								
								src/test/java/fr/packageviewer/ArchTest.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								src/test/java/fr/packageviewer/ArchTest.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,60 @@ | ||||
| package fr.packageviewer; | ||||
| 
 | ||||
| import fr.packageviewer.distribution.ArchDistribution; | ||||
| import fr.packageviewer.distribution.Distribution; | ||||
| import fr.packageviewer.pack.Package; | ||||
| import org.junit.jupiter.api.Assertions; | ||||
| import org.junit.jupiter.api.Test; | ||||
| 
 | ||||
| import java.util.concurrent.ExecutionException; | ||||
| 
 | ||||
| public class ArchTest { | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testBasicQueryDoNotFail(){ | ||||
| 		Distribution arch = new ArchDistribution(); | ||||
| 		arch.getPackageTree("bash", 0); | ||||
| 	} | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testBashPackageHasNameBash() throws ExecutionException, InterruptedException { | ||||
| 		Distribution arch = new ArchDistribution(); | ||||
| 		Package pack = arch.getPackageTree("bash", 0).get(); | ||||
| 		Assertions.assertEquals(pack.getName(), "bash"); | ||||
| 	} | ||||
| 	@Test | ||||
| 	public void testQueryWithDepth0HasNoDeps() throws ExecutionException, InterruptedException { | ||||
| 		Distribution arch = new ArchDistribution(); | ||||
| 		Package pack = arch.getPackageTree("bash", 0).get(); | ||||
| 		Assertions.assertEquals(pack.getDeps().size(), 0); | ||||
| 	} | ||||
| 	@Test | ||||
| 	public void testQueryWithDepth1hasOneLevelOfDeps() throws ExecutionException, InterruptedException { | ||||
| 		Distribution arch = new ArchDistribution(); | ||||
| 		Package pack = arch.getPackageTree("bash", 1).get(); | ||||
| 		Assertions.assertNotEquals(pack.getDeps().size(), 0); | ||||
| 		for(Package dep : pack.getDeps()){ | ||||
| 			Assertions.assertEquals(dep.getDeps().size(), 0); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testBashIsInCore() throws ExecutionException, InterruptedException { | ||||
| 		Distribution arch = new ArchDistribution(); | ||||
| 		Package pack = arch.getPackageTree("bash", 1).get(); | ||||
| 		Assertions.assertEquals(pack.getRepo(), "core"); | ||||
| 	} | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testBashDescriptionIsNotEmpty() throws ExecutionException, InterruptedException { | ||||
| 		Distribution arch = new ArchDistribution(); | ||||
| 		Package pack = arch.getPackageTree("bash", 1).get(); | ||||
| 		Assertions.assertFalse(pack.getDescription().isEmpty()); | ||||
| 	} | ||||
| 	@Test | ||||
| 	public void testBashVersionIsNotEmpty() throws ExecutionException, InterruptedException { | ||||
| 		Distribution arch = new ArchDistribution(); | ||||
| 		Package pack = arch.getPackageTree("bash", 1).get(); | ||||
| 		Assertions.assertFalse(pack.getVersion().isEmpty()); | ||||
| 	} | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user