@Test public void testGetApplication() { Invocation invocation = mock(Invocation.class); when(invocation.getAttachments()).thenReturn(new HashMap<>()); when(invocation.getAttachment(DubboUtils.SENTINEL_DUBBO_APPLICATION_KEY, "")) .thenReturn("consumerA"); String application = DubboUtils.getApplication(invocation, ""); verify(invocation).getAttachment(DubboUtils.SENTINEL_DUBBO_APPLICATION_KEY, ""); assertEquals("consumerA", application); }
public static String getApplication(Invocation invocation, String defaultValue) { if (invocation == null || invocation.getAttachments() == null) { throw new IllegalArgumentException("Bad invocation instance"); } return invocation.getAttachment(SENTINEL_DUBBO_APPLICATION_KEY, defaultValue); }
DubboUtils { public static String getApplication(Invocation invocation, String defaultValue) { if (invocation == null || invocation.getAttachments() == null) { throw new IllegalArgumentException("Bad invocation instance"); } return invocation.getAttachment(SENTINEL_DUBBO_APPLICATION_KEY, defaultValue); } }
DubboUtils { public static String getApplication(Invocation invocation, String defaultValue) { if (invocation == null || invocation.getAttachments() == null) { throw new IllegalArgumentException("Bad invocation instance"); } return invocation.getAttachment(SENTINEL_DUBBO_APPLICATION_KEY, defaultValue); } private  DubboUtils(); }
DubboUtils { public static String getApplication(Invocation invocation, String defaultValue) { if (invocation == null || invocation.getAttachments() == null) { throw new IllegalArgumentException("Bad invocation instance"); } return invocation.getAttachment(SENTINEL_DUBBO_APPLICATION_KEY, defaultValue); } private  DubboUtils(); static String getApplication(Invocation invocation, String defaultValue); static String getResourceName(Invoker<?> invoker, Invocation invocation); }
DubboUtils { public static String getApplication(Invocation invocation, String defaultValue) { if (invocation == null || invocation.getAttachments() == null) { throw new IllegalArgumentException("Bad invocation instance"); } return invocation.getAttachment(SENTINEL_DUBBO_APPLICATION_KEY, defaultValue); } private  DubboUtils(); static String getApplication(Invocation invocation, String defaultValue); static String getResourceName(Invoker<?> invoker, Invocation invocation); static final String SENTINEL_DUBBO_APPLICATION_KEY; }