|
| 1 | +/* |
| 2 | + * #%L |
| 3 | + * SciJava Common shared library for SciJava software. |
| 4 | + * %% |
| 5 | + * Copyright (C) 2009 - 2017 Board of Regents of the University of |
| 6 | + * Wisconsin-Madison, Broad Institute of MIT and Harvard, Max Planck |
| 7 | + * Institute of Molecular Cell Biology and Genetics, University of |
| 8 | + * Konstanz, and KNIME GmbH. |
| 9 | + * %% |
| 10 | + * Redistribution and use in source and binary forms, with or without |
| 11 | + * modification, are permitted provided that the following conditions are met: |
| 12 | + * |
| 13 | + * 1. Redistributions of source code must retain the above copyright notice, |
| 14 | + * this list of conditions and the following disclaimer. |
| 15 | + * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 16 | + * this list of conditions and the following disclaimer in the documentation |
| 17 | + * and/or other materials provided with the distribution. |
| 18 | + * |
| 19 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 20 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
| 23 | + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 24 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 25 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 28 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 | + * POSSIBILITY OF SUCH DAMAGE. |
| 30 | + * #L% |
| 31 | + */ |
| 32 | + |
| 33 | +package org.scijava; |
| 34 | + |
| 35 | +import static org.junit.Assert.assertEquals; |
| 36 | +import static org.junit.Assert.assertNotNull; |
| 37 | +import static org.junit.Assert.assertSame; |
| 38 | + |
| 39 | +import org.junit.Test; |
| 40 | +import org.scijava.plugin.PluginInfo; |
| 41 | + |
| 42 | +/** |
| 43 | + * Tests {@link SciJava}. |
| 44 | + * |
| 45 | + * @author Curtis Rueden |
| 46 | + */ |
| 47 | +public class SciJavaTest { |
| 48 | + |
| 49 | + @Test |
| 50 | + public void testInfo() { |
| 51 | + final SciJava sj = new SciJava(); |
| 52 | + |
| 53 | + final PluginInfo<?> infoFromObject = sj.getInfo(); |
| 54 | + final PluginInfo<?> infoFromServiceNoType = // |
| 55 | + sj.plugin().getPlugin(SciJava.class); |
| 56 | + final PluginInfo<Gateway> infoFromServiceWithType = // |
| 57 | + sj.plugin().getPlugin(SciJava.class, Gateway.class); |
| 58 | + assertSame(infoFromServiceNoType, infoFromObject); |
| 59 | + assertSame(infoFromServiceWithType, infoFromObject); |
| 60 | + |
| 61 | + assertNotNull(infoFromObject); |
| 62 | + assertSame(Gateway.class, infoFromObject.getPluginType()); |
| 63 | + |
| 64 | + assertEquals(Priority.NORMAL, sj.getPriority(), 0); |
| 65 | + |
| 66 | + sj.dispose(); |
| 67 | + } |
| 68 | +} |
0 commit comments