photo-manager / PHOTO MANAGER / src / tests / StudentTests.java
StudentTests.java
Raw
package tests;

import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;

import photomanager.*;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)

public class StudentTests {
	
	PhotoManager test = new PhotoManager();
	
//	TESTING PHOTO.JAVA 
	
	@Test
	public void testToStringPhoto() {
		Photo newPhoto = new Photo("umcp/college1.jpg", 5, 10, "2012-12-12");
		System.out.println(newPhoto);
	}
	
	@Test
	public void testGetPhotoSource() {
		Photo newPhoto = new Photo("umcp/college1.jpg", 5, 10, "2012-12-12");
		System.out.println(newPhoto.getPhotoSource());
	}
	
	@Test
	public void testGetWidth() {
		Photo newPhoto = new Photo("umcp/college1.jpg", 5, 10, "2012-12-12");
		System.out.println(newPhoto.getWidth());
	}
	
	@Test
	public void testGetHeight() {
		Photo newPhoto = new Photo("umcp/college1.jpg", 5, 10, "2012-12-12");
		System.out.println(newPhoto.getHeight());
	}
	
	@Test
	public void testGetDate() {
		Photo newPhoto = new Photo("umcp/college1.jpg", 5, 10, "2012-12-12");
		System.out.println(newPhoto.getDate());
	}
	
	@Test
	public void testAddCommentsGetComments() {
		Photo newPhoto = new Photo("umcp/college1.jpg", 5, 10, "2012-12-12");
		System.out.println(newPhoto.addComments(""));
		System.out.println(newPhoto.addComments(null));
		System.out.println(newPhoto.addComments("please give me points :)"));
		System.out.println(newPhoto.getComments());
	}
	
	@Test
	public void testCompareTo() {
		Photo smallerDatePhoto = new Photo("umcp/college1.jpg", 5, 10, "2012-12-12");
		Photo largerDatePhoto = new Photo("umcp/college1.jpg", 5, 10, "2045-12-12");
		
		System.out.println(smallerDatePhoto.compareTo(largerDatePhoto));
		System.out.println(smallerDatePhoto.compareTo(smallerDatePhoto));
	}
	
	
	
	
	
//	TESTING PHOTOMANAGER.JAVA
	
	
	@Test
	public void testAddPhoto() {
		System.out.println(test.addPhoto("umcp/college1.jpg", 5, 10, "2012-12-12")); //how do I fix this?
	}
	
	@Test
	public void testToStringPhotoManager() { 
		test.addPhoto("umcp/college1.jpg", 5, 10, "2012-12-12");
		test.addPhoto("umcp/college2.jpg", 10, 10, "2024-12-12");
		
		System.out.println(test.toString()); 
	}
	
	@Test
	public void testFindPhoto() {
		Photo newPhoto1 = new Photo("umcp/college1.jpg", 5, 10, "2012-12-12");
		Photo newPhoto2 = new Photo("umcp/college2.jpg", 5, 10, "2030-12-12");
		test.addPhoto("umcp/college1.jpg", 5, 10, "2012-12-12");
		test.addPhoto("umcp/college2.jpg", 5, 10, "2030-12-12");
		
		System.out.println(test.findPhoto(newPhoto1.getPhotoSource()));
		System.out.println(test.findPhoto(newPhoto2.getPhotoSource()));
	}
	
	@Test
	public void testAddComment() {
		
		
		
	}
	
	@Test
	public void testGetCommentsPhotoManager() { 
		
	}
	
	@Test
	public void testRemoveAllPhotos() {
		test.addPhoto("umcp/college1.jpg", 5, 10, "2012-12-12");
		test.addPhoto("umcp/college2.jpg", 5, 10, "2030-12-12");
		System.out.println(test.toString());
		test.removeAllPhotos();
		System.out.println(test.toString());
	}
	
	@Test
	public void testRemovePhoto() {
		test.addPhoto("umcp/college1.jpg", 5, 10, "2012-12-12");
		System.out.println(test.toString());
		System.out.println(test.removePhoto(null));
		System.out.println(test.removePhoto("umcp/college1.jpg"));
		System.out.println(test.toString());
	}
	
	@Test
	public void testLoadPhotos() { //difference ?
		test.addPhoto("umcp/college1.jpg", 5, 10, "2012-12-12");
		
		System.out.println(test.loadPhotos(null));
		System.out.println(test.loadPhotos("umcp/college1.jpg"));
		System.out.println(test.toString());
	}
	
	@Test
	public void testSortPhotosByDate() {
		
		test.addPhoto("umcp/college1.jpg", 5, 10, "10/18/2020-17:10");
		
		test.addPhoto("umcp/college2.jpg", 5, 10, "10/18/2010-17:10");
		
		test.addPhoto("umcp/college3.jpg", 5, 10, "10/18/2000-17:10");
		
		test.addPhoto("umcp/college4.jpg", 5, 10, "10/18/2005-17:10");
		
		test.sortPhotosByDate();
		
		System.out.println(test.toString());
		
	}
}