1 /* Copyright (C) 2009  Egon Willighagen <egonw@users.sf.net>
2  *
3  * Contact: cdk-devel@lists.sourceforge.net
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License as published by the Free
7  * Software Foundation; either version 2.1 of the License, or (at your option)
8  * any later version. All we ask is that proper credit is given for our work,
9  * which includes - but is not limited to - adding the above copyright notice to
10  * the beginning of your source code files, and to any copyright notice that you
11  * may distribute with programs based on this work.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 package org.openscience.cdk.renderer.color;
23 
24 import java.awt.Color;
25 
26 import org.junit.Assert;
27 import org.junit.Test;
28 import org.openscience.cdk.Atom;
29 import org.openscience.cdk.CDKTestCase;
30 import org.openscience.cdk.PseudoAtom;
31 import org.openscience.cdk.interfaces.IAtom;
32 
33 /**
34  * @cdk.module test-render
35  */
36 public class PartialAtomicChargeColorsTest extends CDKTestCase {
37 
38     @Test
testGetAtomColor()39     public void testGetAtomColor() {
40         PartialAtomicChargeColors colors = new PartialAtomicChargeColors();
41         Assert.assertNotNull(colors);
42         IAtom hydrogen = new Atom("H");
43         hydrogen.setAtomicNumber(1);
44         Assert.assertEquals(Color.white, colors.getAtomColor(hydrogen));
45         IAtom helium = new Atom("He");
46         helium.setAtomicNumber(2);
47         Assert.assertEquals(Color.white, colors.getAtomColor(helium));
48     }
49 
50     @Test
testGetDefaultAtomColor()51     public void testGetDefaultAtomColor() {
52         PartialAtomicChargeColors colors = new PartialAtomicChargeColors();
53 
54         Assert.assertNotNull(colors);
55         IAtom imaginary = new PseudoAtom("Ix");
56         Assert.assertEquals(Color.ORANGE, colors.getAtomColor(imaginary, Color.ORANGE));
57     }
58 }
59