@Test public void testGetBoolean6() throws Throwable { Properties props = new Properties(); SimpleConfiguration simpleConfiguration = new SimpleConfiguration(props); props.clear(); props.put("testString", "testString"); String name = (String) props.put("testString", new ArrayList()); boolean result = simpleConfiguration.getBoolean(name); assertFalse("result", result); }
private void initSM() throws ConfigurationException { sm = new JCESecurityModule(); sm.setLogger(log.getLogger(), "SSM"); Properties props = new Properties(); props.put("lmk", "build/resources/test/org/jpos/security/lmk-test"); props.put("provider", "com.sun.crypto.provider.SunJCE"); sm.setConfiguration(new SimpleConfiguration(props)); }
@Test public void testGetBoolean1() throws Throwable { SimpleConfiguration simpleConfiguration = new SimpleConfiguration(new Properties()); simpleConfiguration.put("testString", ""); boolean result = simpleConfiguration.getBoolean("testString", false); assertFalse("result", result); }
@Test public void testGetBoolean5() throws Throwable { SimpleConfiguration simpleConfiguration = new SimpleConfiguration(new Properties()); simpleConfiguration.put("testString", ""); boolean result = simpleConfiguration.getBoolean("testString"); assertFalse("result", result); }
@Test public void testGetIntThrowsNumberFormatException() throws Throwable { SimpleConfiguration simpleConfiguration = new SimpleConfiguration(new Properties()); simpleConfiguration.put("testString", ""); try { simpleConfiguration.getInt("testString", 100); fail("Expected NumberFormatException to be thrown"); } catch (NumberFormatException ex) { assertEquals("ex.getMessage()", "For input string: \"\"", ex.getMessage()); } }
@Test public void testGetBooleanThrowsNullPointerException() throws Throwable { try { new SimpleConfiguration((Properties) null).getBoolean("testSimpleConfigurationName", true); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); } }
@Test public void testGetDoubleThrowsNullPointerException1() throws Throwable { try { new SimpleConfiguration((Properties) null).getDouble("testSimpleConfigurationName", 100.0); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); } }
@Test public void testSetConfiguration() throws Throwable { BaseSMAdapter baseSMAdapter = new BaseSMAdapter(); Configuration cfg = new SimpleConfiguration(); baseSMAdapter.setConfiguration(cfg); assertSame("baseSMAdapter.cfg", cfg, baseSMAdapter.cfg); }
@Test public void testSetConfiguration() throws Throwable { BSHFilter bSHFilter = new BSHFilter(); Configuration cfg = new SimpleConfiguration(); bSHFilter.setConfiguration(cfg); assertSame("bSHFilter.cfg", cfg, bSHFilter.cfg); } }
@Before public void setUp() throws Exception { cfg = new SimpleConfiguration(); queryHost = new QueryHost(); queryHost.setConfiguration(cfg); NameRegistrar.register("mux.TEST", this); }
@Test public void testSetConfiguration() throws Throwable { ChannelPool channelPool = new ChannelPool(); Configuration cfg = new SimpleConfiguration(); channelPool.setConfiguration(cfg); assertSame("channelPool.cfg", cfg, channelPool.cfg); }
@Test public void testSetConfiguration() throws Throwable { BSHRequestListener bSHRequestListener = new BSHRequestListener(); Configuration cfg = new SimpleConfiguration(); bSHRequestListener.setConfiguration(cfg); assertEquals("bSHRequestListener.whitelist.size()", 1, bSHRequestListener.whitelist.size()); assertEquals("bSHRequestListener.bshSource.length", 0, bSHRequestListener.bshSource.length); assertSame("bSHRequestListener.cfg", cfg, bSHRequestListener.cfg); }
@Test public void testGetDouble() throws Throwable { Configuration cfg = new SimpleConfiguration(); SubConfiguration subConfiguration = new SubConfiguration(cfg, "testSubConfigurationPrefix"); double result = subConfiguration.getDouble("testSubConfigurationPropertyName"); assertEquals("result", 0.0, result, 1.0E-6); assertSame("subConfiguration.cfg", cfg, subConfiguration.cfg); }
@Test public void testGetLong2() throws Throwable { Configuration cfg = new SimpleConfiguration(); SubConfiguration subConfiguration = new SubConfiguration(cfg, "testSubConfigurationPrefix"); long result = subConfiguration.getLong("testSubConfigurationPropertyName"); assertEquals("result", 0L, result); assertSame("subConfiguration.cfg", cfg, subConfiguration.cfg); }
@Test public void testLog() throws Throwable { BSHLogListener bSHLogListener = new BSHLogListener(); Configuration cfg = new SimpleConfiguration(new Properties()); bSHLogListener.setConfiguration(cfg); LogEvent ev = new LogEvent("testBSHLogListenerTag"); ev.setSource(new LogChannel()); LogEvent result = bSHLogListener.log(ev); assertSame("result", ev, result); assertSame("bSHLogListener.cfg", cfg, bSHLogListener.cfg); }
@Test public void testSetConfiguration() throws Throwable { MD5Filter mD5Filter = new MD5Filter(); mD5Filter.setConfiguration(new SimpleConfiguration()); assertEquals("mD5Filter.key", "", mD5Filter.key); assertEquals("mD5Filter.fields.length", 0, mD5Filter.fields.length); }
@Test public void testProcess() throws Throwable { BSHRequestListener bSHRequestListener = new BSHRequestListener(); bSHRequestListener.setConfiguration(new SimpleConfiguration()); boolean result = bSHRequestListener.process(new PostChannel(), new ISOMsg("testBSHRequestListenerMti")); assertFalse("result should be false", result); //there is no source to process assertEquals("bSHRequestListener.whitelist.size()", 1, bSHRequestListener.whitelist.size()); }
@Test public void testSetConfiguration() throws Throwable { SubConfiguration subConfiguration = new SubConfiguration(new SubConfiguration(), "testSubConfigurationPrefix"); Configuration newCfg = new SimpleConfiguration(); subConfiguration.setConfiguration(newCfg); assertSame("subConfiguration.cfg", newCfg, subConfiguration.cfg); }
@Test public void testSetConfiguration1() throws Throwable { MacroFilter macroFilter = new MacroFilter(); Configuration cfg = new SimpleConfiguration(); macroFilter.setConfiguration(cfg); macroFilter.setConfiguration(cfg); assertSame("macroFilter.cfg", cfg, macroFilter.cfg); assertEquals("macroFilter.unsetFields.length", 0, macroFilter.unsetFields.length); assertEquals("macroFilter.validFields.length", 0, macroFilter.validFields.length); }
@Test public void testFilter1() throws Throwable { BSHFilter bSHFilter = new BSHFilter(); Configuration cfg = new SimpleConfiguration(); bSHFilter.setConfiguration(cfg); ISOChannel channel = new CSChannel(); LogEvent evt = new LogEvent(); ISOVMsg result = (ISOVMsg) bSHFilter.filter(channel, m, evt); assertSame("result", m, result); assertSame("bSHFilter.cfg", cfg, bSHFilter.cfg); }