1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
/*
* BioJava development code
*
* This code may be freely distributed and modified under the
* terms of the GNU Lesser General Public Licence. This should
* be distributed with the code. If you do not have a copy,
* see:
*
* http://www.gnu.org/copyleft/lesser.html
*
* Copyright for this code is held jointly by the individual
* authors. These should be listed in @author doc comments.
*
* For more information on the BioJava project and its aims,
* or to join the biojava-l mailing list, visit the home page
* at:
*
* http://www.biojava.org/
*
*/
/*
* AAindexTest.java
*/
package org.biojava.bio.proteomics.aaindex;
import junit.framework.TestCase;
import org.biojava.bio.seq.DNATools;
import org.biojava.bio.seq.ProteinTools;
import org.biojava.bio.symbol.IllegalSymbolException;
/**
* Test class for {@link org.biojava.bio.proteomics.aaindex.AAindex}.
* @author <a href="mailto:Martin.Szugat@GMX.net">Martin Szugat</a>
* @version $Revision: 4023 $
*/
public class AAindexTest extends TestCase {
/**
* Main entry point.
* @param args command line arguments
*/
public static void main(String[] args) {
junit.textui.TestRunner.run(AAindexTest.class);
}
/**
* AAindex object.
*/
private AAindex aaindex = null;
/**
* {@inheritDoc}
*/
protected void setUp() throws Exception {
super.setUp();
aaindex = new AAindex("test");
}
/**
* Test for {@link AAindex#accessionNumber()}.
*/
public void testAccessionNumber() {
assertEquals("test", aaindex.accessionNumber());
}
/**
* Test for {@link AAindex#getArticleAuthors()}.
*/
public void testGetArticleAuthors() {
assertNull(aaindex.getArticleAuthors());
}
/**
* Test for {@link AAindex#setArticleAuthors(String)}.
*/
public void testSetArticleAuthors() {
aaindex.setArticleAuthors("authors");
assertEquals("authors", aaindex.getArticleAuthors());
}
/**
* Test for {@link AAindex#getComment()}.
*/
public void testGetComment() {
assertNull(aaindex.getComment());
}
/**
* Test for {@link AAindex#setComment(String)}.
*/
public void testSetComment() {
aaindex.setComment("comment");
assertEquals("comment", aaindex.getComment());
}
/**
* Test for {@link AAindex#getArticleTitle()}.
*/
public void testGetArticleTitle() {
assertNull(aaindex.getArticleTitle());
}
/**
* Test for {@link AAindex#setArticleTitle(String)}.
*/
public void testSetArticleTitle() {
aaindex.setArticleTitle("title");
assertEquals("title", aaindex.getArticleTitle());
}
/**
* Test for {@link AAindex#getDescription()}.
*/
public void testGetDescription() {
assertNull(aaindex.getDescription());
}
/**
* Test for {@link AAindex#setDescription(String)}.
*/
public void testSetDescription() {
aaindex.setDescription("description");
assertEquals("description", aaindex.getDescription());
}
/**
* Test for {@link AAindex#getJournalReference()}
*/
public void testGetJournalReference() {
assertNull(aaindex.getJournalReference());
}
/**
* Test for {@link AAindex#setJournalReference(String)}.
*/
public void testSetJournalReference() {
aaindex.setJournalReference("journal");
assertEquals("journal", aaindex.getJournalReference());
}
/**
* Test for {@link AAindex#getLITDBEntryNumbers()}.
*/
public void testGetLITDBEntryNumbers() {
assertNull(aaindex.getLITDBEntryNumbers());
}
/**
* Test for {@link AAindex#setLITDBEntryNumbers(String[])}.
*/
public void testSetLITDBEntryNumbers() {
aaindex.setLITDBEntryNumbers(new String[] {"lit"});
assertEquals("lit", aaindex.getLITDBEntryNumbers()[0]);
}
/**
* Test for {@link AAindex#similarEntries()}.
*/
public void testSimilarEntries() {
assertEquals(0, aaindex.similarEntries().size());
aaindex.similarEntries().put("test", new Double(0.0));
assertEquals(new Double(0.0), aaindex.similarEntries().get("test"));
}
/**
* Test for {@link org.biojava.bio.symbol.SymbolPropertyTable#getName()}.
*/
public void testGetName() {
assertEquals("test", aaindex.getName());
}
/**
* Test for {@link org.biojava.bio.symbol.SymbolPropertyTable#getAlphabet()}.
*/
public void testGetAlphabet() {
assertEquals(ProteinTools.getAlphabet(), aaindex.getAlphabet());
}
/**
* Test for {@link org.biojava.bio.symbol.SymbolPropertyTable#getDoubleValue(org.biojava.bio.symbol.Symbol)}.
* @throws IllegalSymbolException if a symbol is illegal.
*/
public void testDoubleValue() throws IllegalSymbolException {
aaindex.setDoubleProperty(ProteinTools.gln(), "1.0");
assertEquals(1.0, aaindex.getDoubleValue(ProteinTools.gln()), 0.0);
try {
aaindex.getDoubleValue(DNATools.a());
fail("IllegalSymbolException not thrown.");
} catch (IllegalSymbolException e) {
e.printStackTrace();
}
}
}
|