### Question:
GP4Parser implements Parser { protected int nbPlayerString(int stringsPlayer) { int res = 0; for (int i = 0; i < GP4_NUMBER_OF_STRING; i++) { if ((stringsPlayer & (1 << i)) != 0) { res++; } } return res; }  void close(); void openFile(File file); @Inject void setListener(GP4ParserListener listener); static final int VERSION_LENGTH; }### Answer:
@Test public void testNbStringPlayed() { int stringCode = 2; int result; int expResult = 1; result = instance.nbPlayerString(stringCode); Assert.assertEquals(result, expResult); stringCode = 4; result = instance.nbPlayerString(stringCode); Assert.assertEquals(result, expResult); stringCode = 8; result = instance.nbPlayerString(stringCode); Assert.assertEquals(result, expResult); stringCode = 32; result = instance.nbPlayerString(stringCode); Assert.assertEquals(result, expResult); stringCode = 64; result = instance.nbPlayerString(stringCode); Assert.assertEquals(result, expResult); stringCode = 0xC; expResult = 2; result = instance.nbPlayerString(stringCode); Assert.assertEquals(result, expResult); }