[rfc][icedtea-web] PluginMessage test time zone

Omair Majid omajid at redhat.com
Thu Jun 5 17:11:43 UTC 2014


* Lukasz Dracz <ldracz at redhat.com> [2014-06-04 11:56]:
> From: "Omair Majid" <omajid at redhat.com>
> > An alternative is to explicitly set (and then restore) the locale using
> > Locale.setDefault() in a @Before (and restore in an @After) method. This
> > ensures the test always sees the same locale, irrespective of the system
> > locale. If you are dealing with timestamps, this is often an easier
> > approach to use.
> 
> Thank you for your suggestion, I have looked into this and implemented it in this way.

That's not quite what I meant, but in this case, this works perfectly
fine too.

> +    private static String TEST_TIME;
> +    String s1 = "plugindebug 1384850630162925 [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG]["+TEST_TIME+"][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1204] ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0:   PIPE: plugin read: plugin PluginProxyInfo reference 1 http://www.walter-fendt.de:80";

I see that Andrew already pointed out the issue with mixing static and
non-static variables and how the result of this String expansion is not
obvious.

For a future enhancement, please look at splitting this string into
multiple lines to make it easier to read.

> +        Assert.assertTrue(p1.header.date.toString().contains(TEST_TIME) && p1.header.date.toString().contains("2013"));
> +        Assert.assertTrue(p3.header.date.toString().contains(TEST_TIME) && p3.header.date.toString().contains("2013"));

TEST_TIME already contains 2013, so maybe the second expression is
redundant?

Thanks,
Omair

-- 
PGP Key: 66484681 (http://pgp.mit.edu/)
Fingerprint = F072 555B 0A17 3957 4E95  0056 F286 F14F 6648 4681


More information about the distro-pkg-dev mailing list