Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.java.programmer Subject: Re: What is the =?utf-8?B?4oCYc3RhbmRhcmTigJk=?= when using a constant in several unit tests Date: Sat, 19 Aug 2017 21:36:29 +0200 Organization: Decebal Computing Lines: 28 Message-ID: <8760djgxj6.fsf@munus.decebal.nl> References: <87k21zh319.fsf@munus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="3820b20d39a2e7728f71dbc5da182e9b"; logging-data="7604"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hFUkjPscBKmg+H9oNVx4YJsYAXqg+7ts=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Homepage: http://www.decebal.nl/ Cancel-Lock: sha1:k1/JyHVd7bJK2KwDrNkOUzm8PIw= sha1:JSr2pAPB9HVhSti+6LswnrG7FHk= Xref: csiph.com comp.lang.java.programmer:37296 ram@zedat.fu-berlin.de (Stefan Ram) writes: > Cecil Westerhof writes: >>I have several test classes that have the following constant: >> private static final String TEST_DB = "testDB.sqlite"; >>Is this the way to do it, or should it be put centrally? > > You can put it into an extra class: > > public final class TestConstants > { public static final java.lang.String TEST_DB = "testDB.sqlite"; } That is not frowned upon? I implemented it. > . Just remember: When the constant is changed, the change > might not have the desired effect, because the value of the > constant might have been compiled ("burned") into other > classes. It might be necessary to force a recompilation > of all the test classes in this case. I am using maven. That takes care of it I think. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof