1 19 20 21 22 package org.apache.james.util.junkscore; 23 24 import junit.framework.TestCase; 25 26 public class JunkScoreImplTest extends TestCase { 27 28 private final static String KEY1 = "KEY1"; 29 private final static double SCORE1 = 20.0; 30 private final static String KEY2 = "KEY2"; 31 private final static double SCORE2 = 2.0; 32 33 public void testJunkScoreImpl() { 34 JunkScore junk = new JunkScoreImpl(); 35 36 assertEquals("Empty", junk.getCompleteStoredScores(), 0.0, 0d); 37 38 assertEquals("No previous stored score", junk.setStoredScore(KEY1, SCORE1), 0.0, 0d); 39 assertEquals("No previous stored score", junk.setStoredScore(KEY2, SCORE1), 0.0, 0d); 40 41 assertEquals("Return the previous stored score", junk.setStoredScore(KEY2, SCORE2), SCORE1, 0d); 42 43 assertEquals("Summarize score", junk.getCompleteStoredScores(), SCORE1 + SCORE2, 0d); 44 45 assertEquals("Get stored score", junk.getStoredScore(KEY1), SCORE1, 0d); 46 assertEquals("Get stored score", junk.getStoredScore(KEY2), SCORE2, 0d); 47 48 assertEquals("Get Map", junk.getStoredScores().size(), 2); 49 50 assertEquals("Reset Score", junk.resetStoredScores(), SCORE1 + SCORE2, 0d); 51 52 assertEquals("No Score", junk.getCompleteStoredScores(), 0.0, 0d); 53 assertEquals("Empty Map", junk.getStoredScores().size(), 0); 54 } 55 56 } 57 | Popular Tags |