public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* javax.imageio.spi.ServiceRegistry
@ 2004-03-22 15:55 Sascha Brawer
  0 siblings, 0 replies; only message in thread
From: Sascha Brawer @ 2004-03-22 15:55 UTC (permalink / raw)
  To: mauve-discuss

[-- Attachment #1: Type: text/plain, Size: 744 bytes --]

Hi,

the attached is a testcase for javax.
imageio.spi.ServiceRegistry.setOrdering. Checks #3, 4, 5, 6, and 7 fail
on JDK 1.4.1_01. However, I think they all should succeed.

Before I file a bug, I'd like to make sure that it isn't my fault. So,
I'd be glad if anyone could review the test case and tell me whether they
think it should succeed.

You'll have to read the API specification for
javax.imageio.spi.ServiceRegistry.setOrdering in order to understand the
testlet.

http://java.sun.com/j2se/1.5.0/docs/api/javax/imageio/spi/
ServiceRegistry.html#setOrdering(java
lang.Class,%20java.lang.Object,%20java.lang.Object)

Thanks in advance for your help,

-- Sascha

Sascha Brawer, brawer@dandelis.ch, http://www.dandelis.ch/people/brawer/ 

[-- Attachment #2: setOrdering.java --]
[-- Type: text/plain, Size: 2656 bytes --]

// Tags: JDK1.4

// Copyright (C) 2004 Sascha Brawer <brawer@dandelis.ch>

// This file is part of Mauve.

// Mauve is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.

// Mauve is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Mauve; see the file COPYING.  If not, write to
// the Free Software Foundation, 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.

package gnu.testlet.javax.imageio.spi.ServiceRegistry;

import gnu.testlet.Testlet;
import gnu.testlet.TestHarness;

import java.util.*;

import javax.imageio.spi.RegisterableService;
import javax.imageio.spi.ServiceRegistry;

/**
 * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
 */
public class setOrdering
  implements Testlet
{
  public void test(TestHarness h)
  {
    Throwable caught;
    ServiceRegistry registry;
    List categories;

    // Set-up.
    categories = new LinkedList();
    categories.add(String.class);
    categories.add(RegisterableService.class);
    registry = new ServiceRegistry(categories.iterator());
    registry.registerServiceProvider("sheep", String.class);
    registry.registerServiceProvider("goat", String.class);
    registry.registerServiceProvider("cow", String.class);

    // Check #1: Unknown category --> IllegalArgumentException.
    caught = null;
    try
      {
        registry.setOrdering(List.class, "foo", "bar");
      }
    catch (Exception ex)
      {
        caught = ex;
      }
    h.check(caught instanceof IllegalArgumentException);

    // Check #2: Twice the same object --> IllegalArgumentException.
    caught = null;
    try
      {
        registry.setOrdering(String.class, "sheep", "sheep");
      }
    catch (Exception ex)
      {
        caught = ex;
      }
    h.check(caught instanceof IllegalArgumentException);

    // Check #3.
    h.check(registry.setOrdering(String.class, "cow", "sheep"));

    // Check #4.
    h.check(registry.setOrdering(String.class, "sheep", "goat"));

    // Check #5.
    Iterator iter = registry.getServiceProviders(String.class, true);
    h.check(iter.next(), "cow");

    // Check #6.
    h.check(iter.next(), "sheep");

    // Check #7.
    h.check(iter.next(), "goat");

    // Check #8.
    h.check(!iter.hasNext());
  }
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-03-22 15:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-22 15:55 javax.imageio.spi.ServiceRegistry Sascha Brawer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).