How to use getCurrentArgument method of org.easymock.EasyMock class

Best Easymock code snippet using org.easymock.EasyMock.getCurrentArgument

Source:TestSchemasWithMock.java Github

copy

Full Screen

...30 EasyMock.replay(this.MockedPrintingVisitor);31 }32 private void mockVisitTerminal() {33 EasyMock.expect(this.MockedPrintingVisitor.visitTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {34 Schema terminal = EasyMock.getCurrentArgument(0);35 System.out.println("Terminal: " + terminal.getFullName());36 return SchemaVisitorAction.CONTINUE;37 }).anyTimes();38 }39 private void mockVisitNonTerminal() {40 EasyMock.expect(this.MockedPrintingVisitor.visitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {41 Schema terminal = EasyMock.getCurrentArgument(0);42 System.out.println("NONTerminal start: " + terminal.getFullName());43 return SchemaVisitorAction.CONTINUE;44 }).anyTimes();45 }46 private void mockAfterVisitNonTerminal() {47 EasyMock.expect(this.MockedPrintingVisitor.afterVisitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {48 Schema terminal = EasyMock.getCurrentArgument(0);49 System.out.println("NONTerminal end: " + terminal.getFullName());50 return SchemaVisitorAction.CONTINUE;51 }).anyTimes();52 }53 private void mockGet() {54 EasyMock.expect(this.MockedPrintingVisitor.get()).andReturn(null).anyTimes();55 }56 }57 @Test58 public void textCloning() {59 Schema recSchema = new Schema.Parser().parse(SCHEMA);60 Schemas.visit(recSchema, new MockPrintingVisitor().MockedPrintingVisitor);61 CloningVisitor cv = new CloningVisitor(recSchema);62 Schema trimmed = Schemas.visit(recSchema, cv);63 Assert.assertNull(trimmed.getDoc());64 Assert.assertNotNull(recSchema.getDoc());65 SchemaCompatibility.SchemaCompatibilityType compat = SchemaCompatibility.checkReaderWriterCompatibility(trimmed, recSchema).getType();66 Assert.assertEquals(SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE, compat);67 compat = SchemaCompatibility.checkReaderWriterCompatibility(recSchema, trimmed).getType();68 Assert.assertEquals(SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE, compat);69 Assert.assertNotNull(cv.toString());70 }71 @Test72 public void textCloningCopyDocs() {73 Schema recSchema = new Schema.Parser().parse(SCHEMA);74 Schemas.visit(recSchema, new MockPrintingVisitor().MockedPrintingVisitor);75 Schema trimmed = Schemas.visit(recSchema, new CloningVisitor(new CloningVisitor.PropertyCopier() {76 @Override77 public void copy(final Schema first, final Schema second) {78 Schemas.copyLogicalTypes(first, second);79 Schemas.copyAliases(first, second);80 }81 @Override82 public void copy(final Schema.Field first, final Schema.Field second) {83 Schemas.copyAliases(first, second);84 }85 }, true, recSchema));86 Assert.assertEquals("caca", trimmed.getDoc());87 Assert.assertNotNull(recSchema.getDoc());88 SchemaCompatibility.SchemaCompatibilityType compat = SchemaCompatibility.checkReaderWriterCompatibility(trimmed, recSchema).getType();89 Assert.assertEquals(SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE, compat);90 compat = SchemaCompatibility.checkReaderWriterCompatibility(recSchema, trimmed).getType();91 Assert.assertEquals(SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE, compat);92 }93 @Test(expected = IllegalStateException.class)94 public void testCloningError1() {95 // Visit Terminal with union96 Schema recordSchema = new Schema.Parser()97 .parse("{\"type\": \"record\", \"name\": \"R\", \"fields\":[{\"name\": \"f1\", \"type\": [\"int\", \"long\"]}]}");98 new CloningVisitor(recordSchema).visitTerminal(recordSchema.getField("f1").schema());99 }100 @Test(expected = IllegalStateException.class)101 public void testCloningError2() {102 // After visit Non-terminal with int103 Schema recordSchema = new Schema.Parser()104 .parse("{\"type\": \"record\", \"name\": \"R\", \"fields\":[{\"name\": \"f1\", \"type\": \"int\"}]}");105 new CloningVisitor(recordSchema).afterVisitNonTerminal(recordSchema.getField("f1").schema());106 }107 @Test108 public void testHasGeneratedJavaClass() {109 Assert.assertTrue(Schemas.hasGeneratedJavaClass(new Schema.Parser().parse("{\"type\": \"fixed\", \"name\": \"N\", \"size\": 10}")));110 Assert.assertFalse(Schemas.hasGeneratedJavaClass(new Schema.Parser().parse("{\"type\": \"int\"}")));111 }112 @Test113 public void testGetJavaClassName() {114 Assert.assertEquals("N", Schemas.getJavaClassName(new Schema.Parser().parse("{\"type\": \"fixed\", \"name\": \"N\", \"size\": 10}")));115 Assert.assertEquals("N",116 Schemas.getJavaClassName(new Schema.Parser().parse("{\"type\": \"fixed\", \"name\": \"N\", \"size\": 10, \"namespace\": \"\"}")));117 Assert.assertEquals("com.example.N", Schemas118 .getJavaClassName(new Schema.Parser().parse("{\"type\": \"fixed\", \"name\": \"N\", \"size\": 10, \"namespace\": \"com.example\"}")));119 }120 private static class MockTestVisitor {121 SchemaVisitor<String> MockedTestVisitor;122 StringBuilder sb = new StringBuilder();123 public MockTestVisitor() {124 this.MockedTestVisitor = EasyMock.niceMock(SchemaVisitor.class);125 mockVisitTerminal();126 mockVisitNonTerminal();127 mockAfterVisitNonTerminal();128 mockGet();129 }130 public SchemaVisitor<String> replay() {131 EasyMock.replay(this.MockedTestVisitor);132 return this.MockedTestVisitor;133 }134 private void mockVisitTerminal() {135 EasyMock.expect(this.MockedTestVisitor.visitTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {136 Schema terminal = EasyMock.getCurrentArgument(0);137 sb.append(terminal);138 return SchemaVisitorAction.CONTINUE;139 }).anyTimes();140 }141 private void mockVisitNonTerminal() {142 EasyMock.expect(this.MockedTestVisitor.visitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {143 Schema nonTerminal = EasyMock.getCurrentArgument(0);144 String n = nonTerminal.getName();145 sb.append(n).append('.');146 if (n.startsWith("t")) {147 return SchemaVisitorAction.TERMINATE;148 } else if (n.startsWith("ss")) {149 return SchemaVisitorAction.SKIP_SIBLINGS;150 } else if (n.startsWith("st")) {151 return SchemaVisitorAction.SKIP_SUBTREE;152 } else {153 return SchemaVisitorAction.CONTINUE;154 }155 }).anyTimes();156 }157 private void mockAfterVisitNonTerminal() {158 EasyMock.expect(this.MockedTestVisitor.afterVisitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {159 Schema nonTerminal = EasyMock.getCurrentArgument(0);160 sb.append("!");161 String n = nonTerminal.getName();162 if (n.startsWith("ct")) {163 return SchemaVisitorAction.TERMINATE;164 } else if (n.startsWith("css")) {165 return SchemaVisitorAction.SKIP_SIBLINGS;166 } else if (n.startsWith("cst")) {167 return SchemaVisitorAction.SKIP_SUBTREE;168 } else {169 return SchemaVisitorAction.CONTINUE;170 }171 }).anyTimes();172 }173 private void mockGet() {174 EasyMock.expect(this.MockedTestVisitor.get()).andAnswer(() -> {175 return sb.toString();176 }).anyTimes();177 }178 }179 @Test180 public void testVisit1() {181 String s1 = "{\"type\": \"record\", \"name\": \"t1\", \"fields\": [" + "{\"name\": \"f1\", \"type\": \"int\"}" + "]}";182 Assert.assertEquals("t1.", Schemas.visit(new Schema.Parser().parse(s1), new MockTestVisitor().replay()));183 }184 @Test185 public void testVisit2() {186 String s2 = "{\"type\": \"record\", \"name\": \"c1\", \"fields\": [" + "{\"name\": \"f1\", \"type\": \"int\"}" + "]}";187 Assert.assertEquals("c1.\"int\"!", Schemas.visit(new Schema.Parser().parse(s2), new MockTestVisitor().replay()));188 }189 @Test190 public void testVisit3() {191 String s3 = "{\"type\": \"record\", \"name\": \"ss1\", \"fields\": [" + "{\"name\": \"f1\", \"type\": \"int\"}" + "]}";192 Assert.assertEquals("ss1.", Schemas.visit(new Schema.Parser().parse(s3), new MockTestVisitor().replay()));193 }194 @Test195 public void testVisit4() {196 String s4 = "{\"type\": \"record\", \"name\": \"st1\", \"fields\": [" + "{\"name\": \"f1\", \"type\": \"int\"}" + "]}";197 Assert.assertEquals("st1.!", Schemas.visit(new Schema.Parser().parse(s4), new MockTestVisitor().replay()));198 }199 @Test200 public void testVisit5() {201 String s5 = "{\"type\": \"record\", \"name\": \"c1\", \"fields\": ["202 + "{\"name\": \"f1\", \"type\": {\"type\": \"record\", \"name\": \"c2\", \"fields\": " + "[{\"name\": \"f11\", \"type\": \"int\"}]}},"203 + "{\"name\": \"f2\", \"type\": \"long\"}" + "]}";204 Assert.assertEquals("c1.c2.\"int\"!\"long\"!", Schemas.visit(new Schema.Parser().parse(s5), new MockTestVisitor().replay()));205 }206 @Test207 public void testVisit6() {208 String s6 = "{\"type\": \"record\", \"name\": \"c1\", \"fields\": ["209 + "{\"name\": \"f1\", \"type\": {\"type\": \"record\", \"name\": \"ss2\", \"fields\": "210 + "[{\"name\": \"f11\", \"type\": \"int\"}]}}," + "{\"name\": \"f2\", \"type\": \"long\"}" + "]}";211 Assert.assertEquals("c1.ss2.!", Schemas.visit(new Schema.Parser().parse(s6), new MockTestVisitor().replay()));212 }213 @Test214 public void testVisit7() {215 String s7 = "{\"type\": \"record\", \"name\": \"c1\", \"fields\": ["216 + "{\"name\": \"f1\", \"type\": {\"type\": \"record\", \"name\": \"css2\", \"fields\": "217 + "[{\"name\": \"f11\", \"type\": \"int\"}]}}," + "{\"name\": \"f2\", \"type\": \"long\"}" + "]}";218 Assert.assertEquals("c1.css2.\"int\"!!", Schemas.visit(new Schema.Parser().parse(s7), new MockTestVisitor().replay()));219 }220 @Test(expected = UnsupportedOperationException.class)221 public void testVisit8() {222 String s8 = "{\"type\": \"record\", \"name\": \"c1\", \"fields\": ["223 + "{\"name\": \"f1\", \"type\": {\"type\": \"record\", \"name\": \"cst2\", \"fields\": "224 + "[{\"name\": \"f11\", \"type\": \"int\"}]}}," + "{\"name\": \"f2\", \"type\": \"int\"}" + "]}";225 Schemas.visit(new Schema.Parser().parse(s8), new MockTestVisitor().replay());226 }227 @Test228 public void testVisit9() {229 String s9 = "{\"type\": \"record\", \"name\": \"c1\", \"fields\": ["230 + "{\"name\": \"f1\", \"type\": {\"type\": \"record\", \"name\": \"ct2\", \"fields\": "231 + "[{\"name\": \"f11\", \"type\": \"int\"}]}}," + "{\"name\": \"f2\", \"type\": \"long\"}" + "]}";232 Assert.assertEquals("c1.ct2.\"int\"!", Schemas.visit(new Schema.Parser().parse(s9), new MockTestVisitor().replay()));233 }234 private static class MockTestVisitor10 {235 SchemaVisitor<String> MockedTestVisitor;236 StringBuilder sb = new StringBuilder();237 public MockTestVisitor10() {238 this.MockedTestVisitor = EasyMock.niceMock(SchemaVisitor.class);239 mockVisitTerminal();240 mockVisitNonTerminal();241 mockAfterVisitNonTerminal();242 mockGet();243 }244 public SchemaVisitor<String> replay() {245 EasyMock.replay(this.MockedTestVisitor);246 return this.MockedTestVisitor;247 }248 private void mockVisitTerminal() {249 EasyMock.expect(this.MockedTestVisitor.visitTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {250 return SchemaVisitorAction.SKIP_SUBTREE;251 }).anyTimes();252 }253 private void mockVisitNonTerminal() {254 EasyMock.expect(this.MockedTestVisitor.visitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {255 Schema nonTerminal = EasyMock.getCurrentArgument(0);256 String n = nonTerminal.getName();257 sb.append(n).append('.');258 if (n.startsWith("t")) {259 return SchemaVisitorAction.TERMINATE;260 } else if (n.startsWith("ss")) {261 return SchemaVisitorAction.SKIP_SIBLINGS;262 } else if (n.startsWith("st")) {263 return SchemaVisitorAction.SKIP_SUBTREE;264 } else {265 return SchemaVisitorAction.CONTINUE;266 }267 }).anyTimes();268 }269 private void mockAfterVisitNonTerminal() {270 EasyMock.expect(this.MockedTestVisitor.afterVisitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {271 Schema nonTerminal = EasyMock.getCurrentArgument(0);272 sb.append("!");273 String n = nonTerminal.getName();274 if (n.startsWith("ct")) {275 return SchemaVisitorAction.TERMINATE;276 } else if (n.startsWith("css")) {277 return SchemaVisitorAction.SKIP_SIBLINGS;278 } else if (n.startsWith("cst")) {279 return SchemaVisitorAction.SKIP_SUBTREE;280 } else {281 return SchemaVisitorAction.CONTINUE;282 }283 }).anyTimes();284 }285 private void mockGet() {286 EasyMock.expect(this.MockedTestVisitor.get()).andAnswer(() -> {287 return sb.toString();288 }).anyTimes();289 }290 }291 @Test(expected = UnsupportedOperationException.class)292 public void testVisit10() {293 String s10 = "{\"type\": \"record\", \"name\": \"c1\", \"fields\": ["294 + "{\"name\": \"f1\", \"type\": {\"type\": \"record\", \"name\": \"ct2\", \"fields\": "295 + "[{\"name\": \"f11\", \"type\": \"int\"}]}}," + "{\"name\": \"f2\", \"type\": \"int\"}" + "]}";296 Schemas.visit(new Schema.Parser().parse(s10), new MockTestVisitor10().replay());297 }298 private static class MockTestVisitor11 {299 SchemaVisitor<String> MockedTestVisitor;300 StringBuilder sb = new StringBuilder();301 public MockTestVisitor11() {302 this.MockedTestVisitor = EasyMock.niceMock(SchemaVisitor.class);303 mockVisitTerminal();304 mockVisitNonTerminal();305 mockAfterVisitNonTerminal();306 mockGet();307 }308 public SchemaVisitor<String> replay() {309 EasyMock.replay(this.MockedTestVisitor);310 return this.MockedTestVisitor;311 }312 private void mockVisitTerminal() {313 EasyMock.expect(this.MockedTestVisitor.visitTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {314 Schema terminal = EasyMock.getCurrentArgument(0);315 sb.append(terminal).append('.');316 return SchemaVisitorAction.SKIP_SIBLINGS;317 }).anyTimes();318 }319 private void mockVisitNonTerminal() {320 EasyMock.expect(this.MockedTestVisitor.visitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {321 Schema nonTerminal = EasyMock.getCurrentArgument(0);322 String n = nonTerminal.getName();323 sb.append(n).append('.');324 if (n.startsWith("t")) {325 return SchemaVisitorAction.TERMINATE;326 } else if (n.startsWith("ss")) {327 return SchemaVisitorAction.SKIP_SIBLINGS;328 } else if (n.startsWith("st")) {329 return SchemaVisitorAction.SKIP_SUBTREE;330 } else {331 return SchemaVisitorAction.CONTINUE;332 }333 }).anyTimes();334 }335 private void mockAfterVisitNonTerminal() {336 EasyMock.expect(this.MockedTestVisitor.afterVisitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {337 Schema nonTerminal = EasyMock.getCurrentArgument(0);338 sb.append("!");339 String n = nonTerminal.getName();340 if (n.startsWith("ct")) {341 return SchemaVisitorAction.TERMINATE;342 } else if (n.startsWith("css")) {343 return SchemaVisitorAction.SKIP_SIBLINGS;344 } else if (n.startsWith("cst")) {345 return SchemaVisitorAction.SKIP_SUBTREE;346 } else {347 return SchemaVisitorAction.CONTINUE;348 }349 }).anyTimes();350 }351 private void mockGet() {352 EasyMock.expect(this.MockedTestVisitor.get()).andAnswer(() -> {353 return sb.toString();354 }).anyTimes();355 }356 }357 @Test358 public void testVisit11() {359 String s11 = "{\"type\": \"record\", \"name\": \"c1\", \"fields\": ["360 + "{\"name\": \"f1\", \"type\": {\"type\": \"record\", \"name\": \"c2\", \"fields\": "361 + "[{\"name\": \"f11\", \"type\": \"int\"},{\"name\": \"f12\", \"type\": \"double\"}" + "]}},"362 + "{\"name\": \"f2\", \"type\": \"long\"}" + "]}";363 Assert.assertEquals("c1.c2.\"int\".!\"long\".!", Schemas.visit(new Schema.Parser().parse(s11), new MockTestVisitor11().replay()));364 }365 private static class MockTestVisitor12 {366 SchemaVisitor<String> MockedTestVisitor;367 StringBuilder sb = new StringBuilder();368 public MockTestVisitor12() {369 this.MockedTestVisitor = EasyMock.niceMock(SchemaVisitor.class);370 mockVisitTerminal();371 mockVisitNonTerminal();372 mockAfterVisitNonTerminal();373 mockGet();374 }375 public SchemaVisitor<String> replay() {376 EasyMock.replay(this.MockedTestVisitor);377 return this.MockedTestVisitor;378 }379 private void mockVisitTerminal() {380 EasyMock.expect(this.MockedTestVisitor.visitTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {381 Schema terminal = EasyMock.getCurrentArgument(0);382 sb.append(terminal).append('.');383 return SchemaVisitorAction.TERMINATE;384 }).anyTimes();385 }386 private void mockVisitNonTerminal() {387 EasyMock.expect(this.MockedTestVisitor.visitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {388 Schema nonTerminal = EasyMock.getCurrentArgument(0);389 String n = nonTerminal.getName();390 sb.append(n).append('.');391 if (n.startsWith("t")) {392 return SchemaVisitorAction.TERMINATE;393 } else if (n.startsWith("ss")) {394 return SchemaVisitorAction.SKIP_SIBLINGS;395 } else if (n.startsWith("st")) {396 return SchemaVisitorAction.SKIP_SUBTREE;397 } else {398 return SchemaVisitorAction.CONTINUE;399 }400 }).anyTimes();401 }402 private void mockAfterVisitNonTerminal() {403 EasyMock.expect(this.MockedTestVisitor.afterVisitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {404 Schema nonTerminal = EasyMock.getCurrentArgument(0);405 sb.append("!");406 String n = nonTerminal.getName();407 if (n.startsWith("ct")) {408 return SchemaVisitorAction.TERMINATE;409 } else if (n.startsWith("css")) {410 return SchemaVisitorAction.SKIP_SIBLINGS;411 } else if (n.startsWith("cst")) {412 return SchemaVisitorAction.SKIP_SUBTREE;413 } else {414 return SchemaVisitorAction.CONTINUE;415 }416 }).anyTimes();417 }418 private void mockGet() {419 EasyMock.expect(this.MockedTestVisitor.get()).andAnswer(() -> {420 return sb.toString();421 }).anyTimes();422 }423 }424 @Test425 public void testVisit12() {426 String s12 = "{\"type\": \"record\", \"name\": \"c1\", \"fields\": ["427 + "{\"name\": \"f1\", \"type\": {\"type\": \"record\", \"name\": \"ct2\", \"fields\": "428 + "[{\"name\": \"f11\", \"type\": \"int\"}]}}," + "{\"name\": \"f2\", \"type\": \"long\"}" + "]}";429 Assert.assertEquals("c1.ct2.\"int\".", Schemas.visit(new Schema.Parser().parse(s12), new MockTestVisitor12().replay()));430 }431 private static class MockTestVisitor13 {432 SchemaVisitor<String> MockedTestVisitor;433 StringBuilder sb = new StringBuilder();434 public MockTestVisitor13() {435 this.MockedTestVisitor = EasyMock.niceMock(SchemaVisitor.class);436 mockVisitTerminal();437 mockVisitNonTerminal();438 mockAfterVisitNonTerminal();439 mockGet();440 }441 public SchemaVisitor<String> replay() {442 EasyMock.replay(this.MockedTestVisitor);443 return this.MockedTestVisitor;444 }445 private void mockVisitTerminal() {446 EasyMock.expect(this.MockedTestVisitor.visitTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {447 Schema terminal = EasyMock.getCurrentArgument(0);448 sb.append(terminal).append('.');449 return SchemaVisitorAction.SKIP_SIBLINGS;450 }).anyTimes();451 }452 private void mockVisitNonTerminal() {453 EasyMock.expect(this.MockedTestVisitor.visitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {454 Schema nonTerminal = EasyMock.getCurrentArgument(0);455 String n = nonTerminal.getName();456 sb.append(n).append('.');457 if (n.startsWith("t")) {458 return SchemaVisitorAction.TERMINATE;459 } else if (n.startsWith("ss")) {460 return SchemaVisitorAction.SKIP_SIBLINGS;461 } else if (n.startsWith("st")) {462 return SchemaVisitorAction.SKIP_SUBTREE;463 } else {464 return SchemaVisitorAction.CONTINUE;465 }466 }).anyTimes();467 }468 private void mockAfterVisitNonTerminal() {469 EasyMock.expect(this.MockedTestVisitor.afterVisitNonTerminal(EasyMock.anyObject(Schema.class))).andAnswer(() -> {470 Schema nonTerminal = EasyMock.getCurrentArgument(0);471 sb.append("!");472 String n = nonTerminal.getName();473 if (n.startsWith("ct")) {474 return SchemaVisitorAction.TERMINATE;475 } else if (n.startsWith("css")) {476 return SchemaVisitorAction.SKIP_SIBLINGS;477 } else if (n.startsWith("cst")) {478 return SchemaVisitorAction.SKIP_SUBTREE;479 } else {480 return SchemaVisitorAction.CONTINUE;481 }482 }).anyTimes();483 }484 private void mockGet() {...

Full Screen

Full Screen

Source:TestGenericDatumWriterWithMock.java Github

copy

Full Screen

...217 private void mockWriteBoolean() {218 try {219 this.MockedTestEncoder.writeBoolean(EasyMock.anyBoolean());220 EasyMock.expectLastCall().andAnswer(() -> {221 boolean b = EasyMock.getCurrentArgument(0);222 e.writeBoolean(b);223 return null;224 }).andThrow(new IOException()).anyTimes();225 } catch (IOException e) {226 e.printStackTrace();227 }228 }229 private void mockWriteInt() {230 try {231 this.MockedTestEncoder.writeInt(EasyMock.anyInt());232 EasyMock.expectLastCall().andAnswer(() -> {233 int n = EasyMock.getCurrentArgument(0);234 e.writeInt(n);235 return null;236 }).andThrow(new IOException()).anyTimes();237 } catch (IOException e) {238 e.printStackTrace();239 }240 }241 private void mockWriteLong() {242 try {243 this.MockedTestEncoder.writeLong(EasyMock.anyLong());244 EasyMock.expectLastCall().andAnswer(() -> {245 long n = EasyMock.getCurrentArgument(0);246 e.writeLong(n);247 return null;248 }).andThrow(new IOException()).anyTimes();249 } catch (IOException e) {250 e.printStackTrace();251 }252 }253 private void mockWriteFloat() {254 try {255 this.MockedTestEncoder.writeFloat(EasyMock.anyFloat());256 EasyMock.expectLastCall().andAnswer(() -> {257 float n = EasyMock.getCurrentArgument(0);258 e.writeFloat(n);259 return null;260 }).andThrow(new IOException()).anyTimes();261 } catch (IOException e) {262 e.printStackTrace();263 }264 }265 private void mockWriteDouble() {266 try {267 this.MockedTestEncoder.writeDouble(EasyMock.anyDouble());268 EasyMock.expectLastCall().andAnswer(() -> {269 double n = EasyMock.getCurrentArgument(0);270 e.writeDouble(n);271 return null;272 }).andThrow(new IOException()).anyTimes();273 } catch (IOException e) {274 e.printStackTrace();275 }276 }277 private void mockWriteString() {278 try {279 this.MockedTestEncoder.writeString(EasyMock.anyObject(Utf8.class));280 EasyMock.expectLastCall().andAnswer(() -> {281 Utf8 utf8 = EasyMock.getCurrentArgument(0);282 e.writeString(utf8);283 return null;284 }).andThrow(new IOException()).anyTimes();285 } catch (IOException e) {286 e.printStackTrace();287 }288 }289 private void mockWriteBytes1() {290 try {291 this.MockedTestEncoder.writeBytes(EasyMock.anyObject(ByteBuffer.class));292 EasyMock.expectLastCall().andAnswer(() -> {293 ByteBuffer bytes = EasyMock.getCurrentArgument(0);294 e.writeBytes(bytes);295 return null;296 }).andThrow(new IOException()).anyTimes();297 } catch (IOException e) {298 e.printStackTrace();299 }300 }301 private void mockWriteBytes2() {302 try {303 this.MockedTestEncoder.writeBytes(EasyMock.anyObject(byte[].class), EasyMock.anyInt(), EasyMock.anyInt());304 EasyMock.expectLastCall().andAnswer(() -> {305 byte[] bytes = EasyMock.getCurrentArgument(0);306 int start = EasyMock.getCurrentArgument(1);307 int len = EasyMock.getCurrentArgument(2);308 e.writeBytes(bytes, start, len);309 return null;310 }).andThrow(new IOException()).anyTimes();311 } catch (IOException e) {312 e.printStackTrace();313 }314 }315 private void mockWriteFixed() {316 try {317 this.MockedTestEncoder.writeFixed(EasyMock.anyObject(byte[].class), EasyMock.anyInt(), EasyMock.anyInt());318 EasyMock.expectLastCall().andAnswer(() -> {319 byte[] bytes = EasyMock.getCurrentArgument(0);320 int start = EasyMock.getCurrentArgument(1);321 int len = EasyMock.getCurrentArgument(2);322 e.writeBytes(bytes, start, len);323 return null;324 }).andThrow(new IOException()).anyTimes();325 } catch (IOException e) {326 e.printStackTrace();327 }328 }329 private void mockWriteEnum() {330 try {331 this.MockedTestEncoder.writeEnum(EasyMock.anyInt());332 EasyMock.expectLastCall().andAnswer(() -> {333 int en = EasyMock.getCurrentArgument(0);334 e.writeEnum(en);335 return null;336 }).andThrow(new IOException()).anyTimes();337 } catch (IOException e) {338 e.printStackTrace();339 }340 }341 private void mockSetItemCount() {342 try {343 this.MockedTestEncoder.setItemCount(EasyMock.anyLong());344 EasyMock.expectLastCall().andAnswer(() -> {345 long itemCount = EasyMock.getCurrentArgument(0);346 e.setItemCount(itemCount);347 return null;348 }).andThrow(new IOException()).anyTimes();349 } catch (IOException e) {350 e.printStackTrace();351 }352 }353 private void mockStartItem() {354 try {355 this.MockedTestEncoder.startItem();356 EasyMock.expectLastCall().andAnswer(() -> {357 e.startItem();358 return null;359 }).andThrow(new IOException()).anyTimes();360 } catch (IOException e) {361 e.printStackTrace();362 }363 }364 private void mockWriteArrayEnd() {365 try {366 this.MockedTestEncoder.writeArrayEnd();367 EasyMock.expectLastCall().andAnswer(() -> {368 e.writeArrayEnd();369 return null;370 }).andThrow(new IOException()).anyTimes();371 } catch (IOException e) {372 e.printStackTrace();373 }374 }375 private void mockWriteMapEnd() {376 try {377 this.MockedTestEncoder.writeMapEnd();378 EasyMock.expectLastCall().andAnswer(() -> {379 e.writeMapEnd();380 return null;381 }).andThrow(new IOException()).anyTimes();382 } catch (IOException e) {383 e.printStackTrace();384 }385 }386 private void mockWriteIndex() {387 try {388 this.MockedTestEncoder.writeIndex(EasyMock.anyInt());389 EasyMock.expectLastCall().andAnswer(() -> {390 int unionIndex = EasyMock.getCurrentArgument(0);391 e.writeIndex(unionIndex);392 return null;393 }).andThrow(new IOException()).anyTimes();394 } catch (IOException e) {395 e.printStackTrace();396 }397 }398 }399 @Test(expected = AvroTypeException.class)400 public void writeDoesNotAllowStringForGenericEnum() throws IOException {401 final String json = "{\"type\": \"record\", \"name\": \"recordWithEnum\"," + "\"fields\": [ " + "{\"name\": \"field\", \"type\": "402 + "{\"type\": \"enum\", \"name\": \"enum\", \"symbols\": " + "[\"ONE\",\"TWO\",\"THREE\"] " + "}" + "}" + "]}";403 Schema schema = new Schema.Parser().parse(json);404 GenericRecord record = new GenericData.Record(schema);...

Full Screen

Full Screen

Source:MockLegacyBinaryEncoder.java Github

copy

Full Screen

...101 private void mockWriteBoolean() {102 try {103 this.MockedLegacyBinaryEncoder.writeBoolean(EasyMock.anyBoolean());104 EasyMock.expectLastCall().andAnswer(() -> {105 boolean b = EasyMock.getCurrentArgument(0);106 out.write(b ? 1 : 0);107 return null;108 }).anyTimes();109 } catch (IOException e) {110 e.printStackTrace();111 }112 }113 private void mockWriteInt() {114 try {115 this.MockedLegacyBinaryEncoder.writeInt(EasyMock.anyInt());116 EasyMock.expectLastCall().andAnswer(() -> {117 int n = EasyMock.getCurrentArgument(0);118 encodeLong(n, out);119 return null;120 }).anyTimes();121 } catch (IOException e) {122 e.printStackTrace();123 }124 }125 private void mockWriteLong() {126 try {127 this.MockedLegacyBinaryEncoder.writeLong(EasyMock.anyLong());128 EasyMock.expectLastCall().andAnswer(() -> {129 long n = EasyMock.getCurrentArgument(0);130 encodeLong(n, out);131 return null;132 }).anyTimes();133 } catch (IOException e) {134 e.printStackTrace();135 }136 }137 private void mockWriteFloat() {138 try {139 this.MockedLegacyBinaryEncoder.writeFloat(EasyMock.anyFloat());140 EasyMock.expectLastCall().andAnswer(() -> {141 float f = EasyMock.getCurrentArgument(0);142 encodeFloat(f, out);143 return null;144 }).anyTimes();145 } catch (IOException e) {146 e.printStackTrace();147 }148 }149 private void mockWriteDouble() {150 try {151 this.MockedLegacyBinaryEncoder.writeDouble(EasyMock.anyDouble());152 EasyMock.expectLastCall().andAnswer(() -> {153 double d = EasyMock.getCurrentArgument(0);154 encodeDouble(d, out);155 return null;156 }).anyTimes();157 } catch (IOException e) {158 e.printStackTrace();159 }160 }161 private void mockWriteString1() {162 try {163 this.MockedLegacyBinaryEncoder.writeString(EasyMock.anyObject(Utf8.class));164 EasyMock.expectLastCall().andAnswer(() -> {165 Utf8 utf8 = EasyMock.getCurrentArgument(0);166 encodeString(utf8.getBytes(), 0, utf8.getByteLength());167 return null;168 }).anyTimes();169 } catch (IOException e) {170 e.printStackTrace();171 }172 }173 private void mockWriteString2() {174 try {175 this.MockedLegacyBinaryEncoder.writeString(EasyMock.anyString());176 EasyMock.expectLastCall().andAnswer(() -> {177 String string = EasyMock.getCurrentArgument(0);178 byte[] bytes = Utf8.getBytesFor(string);179 encodeString(bytes, 0, bytes.length);180 return null;181 }).anyTimes();182 } catch (IOException e) {183 e.printStackTrace();184 }185 }186 private void encodeString(byte[] bytes, int offset, int length) throws IOException {187 encodeLong(length, out);188 out.write(bytes, offset, length);189 }190 private void mockWriteBytes1() {191 try {192 this.MockedLegacyBinaryEncoder.writeBytes(EasyMock.anyObject(ByteBuffer.class));193 EasyMock.expectLastCall().andAnswer(() -> {194 ByteBuffer bytes = EasyMock.getCurrentArgument(0);195 byteWriter.write(bytes);196 return null;197 }).anyTimes();198 } catch (IOException e) {199 e.printStackTrace();200 }201 }202 private void mockWriteBytes2() {203 try {204 this.MockedLegacyBinaryEncoder.writeBytes(EasyMock.anyObject(byte[].class), EasyMock.anyInt(), EasyMock.anyInt());205 EasyMock.expectLastCall().andAnswer(() -> {206 byte[] bytes = EasyMock.getCurrentArgument(0);207 int start = EasyMock.getCurrentArgument(1);208 int len = EasyMock.getCurrentArgument(2);209 encodeLong(len, out);210 out.write(bytes, start, len);211 return null;212 }).anyTimes();213 } catch (IOException e) {214 e.printStackTrace();215 }216 }217 private void mockWriteFixed() {218 try {219 this.MockedLegacyBinaryEncoder.writeFixed(EasyMock.anyObject(byte[].class), EasyMock.anyInt(), EasyMock.anyInt());220 EasyMock.expectLastCall().andAnswer(() -> {221 byte[] bytes = EasyMock.getCurrentArgument(0);222 int start = EasyMock.getCurrentArgument(1);223 int len = EasyMock.getCurrentArgument(2);224 out.write(bytes, start, len);225 return null;226 }).anyTimes();227 } catch (IOException e) {228 e.printStackTrace();229 }230 }231 private void mockWriteEnum() {232 try {233 this.MockedLegacyBinaryEncoder.writeEnum(EasyMock.anyInt());234 EasyMock.expectLastCall().andAnswer(() -> {235 int e = EasyMock.getCurrentArgument(0);236 encodeLong(e, out);237 return null;238 }).anyTimes();239 } catch (IOException e) {240 e.printStackTrace();241 }242 }243 private void mockWriteArrayStart() {244 try {245 this.MockedLegacyBinaryEncoder.writeArrayStart();246 EasyMock.expectLastCall().andAnswer(() -> {247 return null;248 }).anyTimes();249 } catch (IOException e) {250 e.printStackTrace();251 }252 }253 private void mockSetItemCount() {254 try {255 this.MockedLegacyBinaryEncoder.setItemCount(EasyMock.anyLong());256 EasyMock.expectLastCall().andAnswer(() -> {257 long itemCount = EasyMock.getCurrentArgument(0);258 if (itemCount > 0) {259 this.MockedLegacyBinaryEncoder.writeLong(itemCount);260 }261 return null;262 }).anyTimes();263 } catch (IOException e) {264 e.printStackTrace();265 }266 }267 private void mockStartItem() {268 try {269 this.MockedLegacyBinaryEncoder.startItem();270 EasyMock.expectLastCall().andAnswer(() -> {271 return null;272 }).anyTimes();273 } catch (IOException e) {274 e.printStackTrace();275 }276 }277 private void mockWriteArrayEnd() {278 try {279 this.MockedLegacyBinaryEncoder.writeArrayEnd();280 EasyMock.expectLastCall().andAnswer(() -> {281 encodeLong(0, out);282 return null;283 }).anyTimes();284 } catch (IOException e) {285 e.printStackTrace();286 }287 }288 private void mockWriteMapStart() {289 try {290 this.MockedLegacyBinaryEncoder.writeMapStart();291 EasyMock.expectLastCall().andAnswer(() -> {292 return null;293 }).anyTimes();294 } catch (IOException e) {295 e.printStackTrace();296 }297 }298 private void mockWriteMapEnd() {299 try {300 this.MockedLegacyBinaryEncoder.writeMapEnd();301 EasyMock.expectLastCall().andAnswer(() -> {302 encodeLong(0, out);303 return null;304 }).anyTimes();305 } catch (IOException e) {306 e.printStackTrace();307 }308 }309 private void mockWriteIndex() {310 try {311 this.MockedLegacyBinaryEncoder.writeIndex(EasyMock.anyInt());312 EasyMock.expectLastCall().andAnswer(() -> {313 int unionIndex = EasyMock.getCurrentArgument(0);314 encodeLong(unionIndex, out);315 return null;316 }).anyTimes();317 } catch (IOException e) {318 e.printStackTrace();319 }320 }321}...

Full Screen

Full Screen

getCurrentArgument

Using AI Code Generation

copy

Full Screen

1import org.easymock.EasyMock;2import org.easymock.IMocksControl;3import org.easymock.internal.MocksControl;4import org.easymock.internal.ObjectMethodsFilter;5import org.easymock.internal.ProxyFactory;6import org.easymock.internal.ReplayState;7import org.easymock.internal.State;8import org.easymock.internal.StateMachine;9import org.easymock.internal.matchers.Equals;10import org.easymock.internal.matchers.InstanceOf;11import org.easymock.internal.matchers.NotNull;12import org.easymock.internal.matchers.Null;13import org.easymock.internal.matchers.Same;14import org.easymock.internal.matchers.StartsWith;15import org.easymock.internal.matchers.EndsWith;16import org.easymock.internal.matchers.Contains;17import org.easymock.internal.matchers.Regex;18import org.easymock.internal.matchers.LessThan;19import org.easymock.internal.matchers.LessThanOrEqual;20import org.easymock.internal.matchers.GreaterThan;21import org.easymock.internal.matchers.GreaterThanOrEqual;22import org.easymock.internal.matchers.And;23import org.easymock.internal.matchers.Or;24import org.easymock.internal.matchers.Not;25import org.easymock.internal.matchers.Any;26import org.easymock.internal.matchers.ArrayEquals;27import org.easymock.internal.matchers.ArrayContains;28import org.easymock.internal.matchers.ArrayElementEquals;29import org.easymock.internal.matchers.ArrayElementMatcher;30import org.easymock.internal.matchers.ArrayMatcher;31import org.easymock.internal.matchers.Capture;32import org.easymock.internal.matchers.CaptureMatcher;33import org.easymock.internal.matchers.CaptureVarargsMatcher;34import org.easymock.internal.matchers.IArgumentMatcher;35import org.easymock.internal.matchers.IArgumentMatcherExtension;36import org.easymock.internal.matchers.VarargsMatcher;37import org.easymock.internal.matchers.VarargsMatcherExtension;38import org.easymock.internal.matchers.VarargsMatcherExtensionFactory;39import org.easymock.internal.matchers.VarargsMatcherFactory;40import org.easymock.internal.matchers.VarargsMatcherFactoryRegistry;41import org.easymock.internal.matchers.VarargsMatcherRegistry;42import org

Full Screen

Full Screen

getCurrentArgument

Using AI Code Generation

copy

Full Screen

1import org.easymock.EasyMock;2import org.easymock.IArgumentMatcher;3{4 public boolean matches(Object argument)5 {6 return true;7 }8 public void appendTo(StringBuffer buffer)9 {10 buffer.append("GetCurrentArgument");11 }12 public static Object getCurrentArgument()13 {14 EasyMock.reportMatcher(new CurrentArgument());15 return null;16 }17}18{19 public void m1(String s1, String s2)20 {21 System.out.println(s1 + s2);22 }23}24{25 public static void main(String[] args)26 {27 A a = EasyMock.createMock(A.class);28 a.m1("Hello ", (String) CurrentArgument.getCurrentArgument());29 EasyMock.replay(a);30 a.m1("Hello ", "World");31 EasyMock.verify(a);32 }33}

Full Screen

Full Screen

getCurrentArgument

Using AI Code Generation

copy

Full Screen

1import org.easymock.EasyMock;2public class 1 {3 public static void main(String[] args) {4 Object mock = EasyMock.createMock(Object.class);5 mock.toString();6 EasyMock.replay(mock);7 mock.toString();8 System.out.println(EasyMock.getCurrentArgument(0));9 }10}11 System.out.println(EasyMock.getCurrentArgument(0));12 symbol: method getCurrentArgument(int)13public void testGetAll() {14 List<Stock> stocks = new ArrayList<Stock>();15 stocks.add(new Stock("name1", "symbol1", 1));16 stocks.add(new Stock("name2", "symbol2", 2));17 stocks.add(new Stock("name3", "symbol3", 3));18 stocks.add(new Stock("name4", "symbol4", 4));19 stocks.add(new Stock("name5", "symbol5", 5));20 stocks.add(new Stock("name6", "symbol6", 6));21 stocks.add(new Stock("name7", "symbol7", 7));22 stocks.add(new Stock("name8", "symbol8", 8));23 stocks.add(new Stock("name9", "symbol9", 9));24 stocks.add(new Stock("name10", "symbol10", 10));25 stocks.add(new Stock("name11", "symbol11", 11));26 stocks.add(new Stock("name12", "symbol12", 12));27 stocks.add(new Stock("name13", "symbol13", 13));28 stocks.add(new Stock("name14", "symbol14", 14));29 stocks.add(new Stock("name15", "symbol15", 15));30 stocks.add(new Stock("name16", "symbol16", 16));31 stocks.add(new Stock("name17", "symbol17", 17));32 stocks.add(new Stock("name18", "symbol18", 18));33 stocks.add(new Stock("name19", "symbol19", 19));34 stocks.add(new Stock("name20", "symbol

Full Screen

Full Screen

getCurrentArgument

Using AI Code Generation

copy

Full Screen

1public class 1 {2 public void test() {3 List mock = EasyMock.createMock(List.class);4 mock.add("one");5 mock.clear();6 EasyMock.replay(mock);7 mock.add("one");8 mock.add("two");9 mock.clear();10 EasyMock.verify(mock);11 }12}13public class 2 {14 public void test() {15 List mock = EasyMock.createMock(List.class);16 mock.add("one");17 mock.clear();18 EasyMock.replay(mock);19 mock.add("one");20 mock.add("two");21 mock.clear();22 EasyMock.verify(mock);23 }24}25public class 3 {26 public void test() {27 List mock = EasyMock.createMock(List.class);28 mock.add("one");29 mock.clear();30 EasyMock.replay(mock);31 mock.add("one");32 mock.add("two");33 mock.clear();34 EasyMock.verify(mock);35 }36}37public class 4 {38 public void test() {39 List mock = EasyMock.createMock(List.class);40 mock.add("one");41 mock.clear();42 EasyMock.replay(mock);43 mock.add("one");44 mock.add("two");45 mock.clear();46 EasyMock.verify(mock);47 }48}49public class 5 {50 public void test() {51 List mock = EasyMock.createMock(List.class);52 mock.add("one");53 mock.clear();54 EasyMock.replay(mock);55 mock.add("one");56 mock.add("two");57 mock.clear();58 EasyMock.verify(mock);59 }60}

Full Screen

Full Screen

getCurrentArgument

Using AI Code Generation

copy

Full Screen

1package org.easymock.examples;2import org.easymock.EasyMock;3import org.easymock.IArgumentMatcher;4import org.junit.Assert;5import org.junit.Test;6public class GetCurrentArgument {7 public interface IMethods {8 void method(String s);9 }10 public void testGetCurrentArgument() {11 IMethods mock = EasyMock.createMock(IMethods.class);12 mock.method(EasyMock.getCurrentArgument(String.class));13 EasyMock.replay(mock);14 mock.method("1");15 EasyMock.verify(mock);16 }17}18OK (1 test)

Full Screen

Full Screen

getCurrentArgument

Using AI Code Generation

copy

Full Screen

1package org.easymock;2import org.easymock.EasyMock;3public class TestEasyMock {4public static void main(String[] args) {5EasyMock.getCurrentArgument(0);6}7}8 at org.easymock.internal.MocksControl.getCurrentArgument(MocksControl.java:138)9 at org.easymock.EasyMock.getCurrentArgument(EasyMock.java:111)10 at org.easymock.TestEasyMock.main(TestEasyMock.java:7)

Full Screen

Full Screen

getCurrentArgument

Using AI Code Generation

copy

Full Screen

1package org.easymock.examples;2import org.easymock.EasyMock;3import org.easymock.IMocksControl;4public class GetCurrentArgument {5 public static void main(String[] args) {6 IMocksControl control = EasyMock.createControl();7 IMethods mock = control.createMock(IMethods.class);8 mock.simpleMethod("Hello");9 control.replay();10 mock.simpleMethod("Hello");11 String argument = EasyMock.getCurrentArgument(String.class);12 System.out.println(argument);13 control.verify();14 }15}16package org.easymock.examples;17import org.easymock.EasyMock;18import org.easymock.IMocksControl;19public class GetCurrentArguments {20 public static void main(String[] args) {21 IMocksControl control = EasyMock.createControl();22 IMethods mock = control.createMock(IMethods.class);23 mock.twoArgumentMethod("Hello", 1);24 control.replay();25 mock.twoArgumentMethod("Hello", 1);26 Object[] arguments = EasyMock.getCurrentArguments();27 System.out.println(arguments[0]);28 System.out.println(arguments[1]);29 control.verify();30 }31}32package org.easymock.examples;33import org.easymock.EasyMock;34import org.easymock.IMocksControl;35public class GetCurrentArguments {36 public static void main(String[] args) {37 IMocksControl control = EasyMock.createControl();38 IMethods mock = control.createMock(IMethods.class);39 mock.twoArgumentMethod("Hello", 1);40 control.replay();41 mock.twoArgumentMethod("Hello", 1);42 String argument1 = EasyMock.getCurrentArgument(0, String.class);43 Integer argument2 = EasyMock.getCurrentArgument(1, Integer.class);44 System.out.println(argument1);45 System.out.println(argument2);46 control.verify();47 }48}

Full Screen

Full Screen

getCurrentArgument

Using AI Code Generation

copy

Full Screen

1package org.easymock.examples;2import org.easymock.EasyMock;3public class Example1 {4 public static String getFirstArgument(String first, String second) {5 return first;6 }7 public static void main(String[] args) {8 String first = "first";9 String second = "second";10 String result = getFirstArgument(first, second);11 System.out.println("result = " + result);12 String currentArgument = EasyMock.getCurrentArgument(0);13 System.out.println("currentArgument = " + currentArgument);14 }15}16package org.easymock.examples;17import org.easymock.EasyMock;18public class Example2 {19 public static String getFirstArgument(String first, String second) {20 return first;21 }22 public static void main(String[] args) {23 String first = "first";24 String second = "second";25 String result = getFirstArgument(first, second);26 System.out.println("result = " + result);27 String[] currentArguments = EasyMock.getCurrentArguments();28 System.out.println("currentArguments = " + currentArguments[0]);29 }30}31package org.easymock.examples;32import org.easymock.EasyMock;33public class Example3 {34 public static String getFirstArgument(String first, String second) {35 return first;36 }37 public static void main(String[] args) {38 String first = "first";39 String second = "second";40 String result = getFirstArgument(first, second);41 System.out.println("result = " + result);42 String[] currentArguments = EasyMock.getCurrentArguments();43 System.out.println("current

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful