1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package com.sun.star.lib.uno.bridges.java_remote; 25 26 import com.sun.star.bridge.XBridge; 27 import com.sun.star.uno.Type; 28 import com.sun.star.uno.XInterface; 29 30 import org.junit.Test; 31 import static org.junit.Assert.*; 32 33 public final class BridgedObject_Test { 34 @Test test()35 public void test() { 36 RequestHandler handler = new RequestHandler() { 37 public Object sendRequest( 38 String oid, Type type, String operation, Object[] args) 39 { 40 return null; 41 } 42 }; 43 XBridge bridge1 = new TestBridge(); 44 ProxyFactory factory1 = new ProxyFactory(handler, bridge1); 45 XBridge bridge2 = new TestBridge(); 46 ProxyFactory factory2 = new ProxyFactory(handler, bridge2); 47 Object object0 = new Object(); 48 Object object1 = factory1.create("", new Type(XInterface.class)); 49 Object object2 = factory2.create("", new Type(XInterface.class)); 50 assertTrue(BridgedObject.getBridge(object0) == null); 51 assertTrue(BridgedObject.getBridge(object1) == bridge1); 52 assertTrue(BridgedObject.getBridge(object2) == bridge2); 53 } 54 55 private static final class TestBridge implements XBridge { getInstance(String instanceName)56 public Object getInstance(String instanceName) { 57 return null; 58 } 59 getName()60 public String getName() { 61 return null; 62 } 63 getDescription()64 public String getDescription() { 65 return null; 66 } 67 } 68 } 69