Skip to content

Commit e36cbdf

Browse files
author
Philipp Kraus
committed
fix non existing language files
1 parent cde26d1 commit e36cbdf

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

TestCLanguageLabel.java

+9-7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
3333
import org.apache.commons.lang3.ClassUtils;
3434
import org.apache.commons.lang3.StringUtils;
35+
import org.junit.Assert;
36+
import org.junit.Assume;
3537
import org.junit.Test;
3638
import org.lightjason.agentspeak.common.CCommon;
3739

@@ -63,7 +65,6 @@
6365
import java.util.stream.Stream;
6466

6567
import static org.junit.Assert.assertFalse;
66-
import static org.junit.Assert.assertTrue;
6768
import static org.junit.Assume.assumeTrue;
6869

6970

@@ -183,7 +184,8 @@ public void testTranslation()
183184
@Test
184185
public void testResourceString() throws IOException
185186
{
186-
assumeTrue( "no languages are defined for checking", !LANGUAGEPROPERY.isEmpty() );
187+
Assume.assumeTrue( "no languages are defined for checking", !LANGUAGEPROPERY.isEmpty() );
188+
Assume.assumeTrue( "language files does not exist", LANGUAGEPROPERY.values().stream().anyMatch( i -> new File( i ).isFile() ) );
187189

188190
final Set<String> l_ignoredlabel = new HashSet<>();
189191

@@ -202,7 +204,7 @@ public void testResourceString() throws IOException
202204
}
203205
catch ( final IOException l_excpetion )
204206
{
205-
assertTrue( MessageFormat.format( "io error on file [{0}]: {1}", i, l_excpetion.getMessage() ), false );
207+
Assert.fail( MessageFormat.format( "io error on file [{0}]: {1}", i, l_excpetion.getMessage() ) );
206208
return Stream.empty();
207209
}
208210
catch ( final ParseProblemException l_exception )
@@ -239,7 +241,7 @@ public void testResourceString() throws IOException
239241
);
240242

241243
// --- check of any label is found
242-
assertFalse( "translation labels are empty, check naming of translation method", l_label.isEmpty() );
244+
Assert.assertFalse( "translation labels are empty, check naming of translation method", l_label.isEmpty() );
243245

244246
// --- check label towards the property definition
245247
if ( l_ignoredlabel.size() > 0 )
@@ -261,7 +263,7 @@ public void testResourceString() throws IOException
261263

262264
// --- check if all property items are within the parsed labels
263265
l_parseditems.removeAll( l_propertyitems );
264-
assertTrue(
266+
Assert.assertTrue(
265267
MessageFormat.format(
266268
"the following {1,choice,1#key|1<keys} in language [{0}] {1,choice,1#is|1<are} not existing within the language file:\n{2}",
267269
k,
@@ -280,7 +282,7 @@ public void testResourceString() throws IOException
280282
.allMatch( l -> false )
281283
)
282284
.collect( Collectors.toSet() );
283-
assertTrue(
285+
Assert.assertTrue(
284286
MessageFormat.format(
285287
"the following {1,choice,1#key|1<keys} in language [{0}] {1,choice,1#is|1<are} not existing within the source code:\n{2}",
286288
k,
@@ -292,7 +294,7 @@ public void testResourceString() throws IOException
292294
}
293295
catch ( final IOException l_exception )
294296
{
295-
assertTrue( MessageFormat.format( "io exception: {0}", l_exception.getMessage() ), false );
297+
Assert.fail( MessageFormat.format( "io exception: {0}", l_exception.getMessage() ) );
296298
}
297299
} );
298300
}

0 commit comments

Comments
 (0)